new interface | Sololearn: Learn to code for FREE!

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

吉原隆夫

2 Answers

New Answer

+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