0
new interface
I do not really know about new interface. Is the color mean same program languages? I want to learn Java. Basic problems had learned. What do I learn next?
2 ответов
+ 2
An interface is like a class with methods that have a body somewhere else.
ex:
interface myInterface{//contains method with out body
void hello;
}
class myClass implements myInterface{//contains all method body for all methods in myInterface
void hello{
System.out.println("hello");
}
}
+ 1
If you want to access a non final variable in your class that implements an interface. You should use getters and setters because interfaces only have methods