Interface Example, a class implements Like hierarchical inheritance

Java Programming Language Abstarct class and Methods in java (Article) Abstarct class and Methods in java (Program)

5286

Program:

 interface University{
void name();
}

class College1 implements University{
	public void name(){
		System.out.println("IIT");
		}
}
class College2 implements University{
	public void name(){
		System.out.println("MIT");
		}
}

class Interface{
	public static void main(String args[]){
	University d=new College2();
	d.name();
	}
}

Output:

MIT
Press any key to continue . . .

This Particular section is dedicated to Programs only. If you want learn more about Java Programming Language. Then you can visit below links to get more depth on this subject.