new interface | Sololearn: Learn to code for FREE!


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/26/2018 5:54:32 AM


2 Answers

New Answer


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"); } }


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