+ 2

What is the main difference between a normal class and interface class?

26th Dec 2016, 2:27 PM
Aman gautam
Aman gautam - avatar
2 Respuestas
+ 2
An interface is a smart way to do the same thing with several implementations. You can find interfaces able to work on several systems without the need of knowing the specifies (Unix, Osx, Windows, Android, etc.), e.g. if you need to save or store data, using these interfaces you need only to know the abstract method to use. In this way you simplify the code of your program writing only a single command!
26th Dec 2016, 4:18 PM
Michael Isac Girardi
Michael Isac Girardi - avatar
+ 1
Hello, In java an Interface isn't suppose to have any code inside. You do it with the default function but normally it's here to give a behavior to the others class. Exemple you have: Interface Animal { public void feed() {}; } All the class who implement Animal will need to implement the function feed because an animal need to be feed. It's a behavior. Because not all animals will eat the same things.
26th Dec 2016, 3:21 PM
Florian Castelain
Florian Castelain - avatar