Java Interfaces

<<Previous

Next >>




Java Interfaces

An interface is a type definition which has only method declarations and fields. From Java 8, Interfaces could also have default methods

Interface example

	interface Shape {
		float Pi=3.14f;
		float calculateArea();
	}

	interface Vehicle{
		void turnSteeringWheel();
		void applyBrake();
		void accelerate();
		void rightIndicator();
		void leftIndicator();
		void pressHorn();
		void trunHeadlights();
		void onWiper();
	}

<<Previous

Next >>