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?

26th Feb 2018, 5:54 AM
吉原隆夫
吉原隆夫 - avatar
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"); } }
7th Feb 2019, 11:52 PM
Leon Yang
Leon Yang - avatar
+ 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
8th Feb 2019, 12:45 AM
Leon Yang
Leon Yang - avatar