Java variable in interface in Kotlin way

Bios90 :

I am interesting are there any way to replace kotlin interface variable in Java.

E.g. what should i write in java to have same logic

interface ObjectWithId
{
    var id : Long
}

Before facing this problem all my code could be easily converted back to java, but using interface variables breaks 'backward compatibility'. Isn't it?

k5_ :

In java this interface would be:

public interface ObjectWithId {
    long getId();        
    void setId(long p0);
}

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=355875&siteId=1