An interface in Java is a class that provides data abstraction. Abstraction is a way to hide non-relevant and non-essential information from users.
No methods are implemented.
interface Animal {
String Name;
public void eat();
public void drink();
}
An abstract class in Java is a class that has abstract methods. It uses the keyword abstract.
Methods may or may not be implemented
abstract class Animal {
String Name;
public void eat();
{
System.out.println("I eat");
}
public void drink();
}
A concrete class in Java has data members, methods, and their implementations.
All methods are implemented.
public class Animal {
String Name;
public void eat();
{
System.out.println("I eat");
}
public void drink()
{
System.out.println("I drink");
}
}
The simplest difference between all three of these classes is:
Free Resources