Hello,
I don't really understand what HOBBY is.
1. Can we create an object of another class inside an interface?
2. So the reference HOBBY is an constant now, public static final.
I can't access the hi() method: System.out.println(Dream.HOBBY.hi()); Why?
3. I cant' access the hi() method: System.out.println(new Hobby().hi()); Why?
So what can I do with HOBBY?
Please help me understand this :)
interface Desire {
}
interface Dream {
public Hobby HOBBY = new Hobby();
}
public static class Hobby implements Dream, Desire {
static int INDEX = 1;
@Override
public String toString() {
INDEX++;
return "" + INDEX;
}
public void hi(){
System.out.println("hello");
}
}