What is an interface?
Interface is a reference type which consists of only method declarations and constants.
All methods in interface by default public abstract and all fields are public static final eventhough it has not been mentioned explicitly.
Example:
public interface Car
{
int wheel=4;
int paintCar(String color);
int driveCar();
}
All methods in interface by default public abstract and all fields are public static final eventhough it has not been mentioned explicitly.
Example:
public interface Car
{
int wheel=4;
int paintCar(String color);
int driveCar();
}
nice example .. thanks a lot
ReplyDeleteThanks for visiting our blog
DeleteEnter some more oops concepts related real time examples.
ReplyDelete