Programming in Java
Object Oriented in Java
Advanced topics in Java
Modal Box
Tutorials
C is a very powerful and widely used language. It is used in many scientific programming situations. It forms (or is the basis for) the core of the modern languages Java and C++. It allows you access to the bare bones of your computer.C++ is used for operating systems, games, embedded software, autonomous cars and medical technology, as well as many other applications. Don't forget to visit this section...
Interface in java
Interface in java is an alternative to achieve multiple inheritance
similarly, as abstract class interface may not be instanciated.
In java code is written either in class or in interface
⇒ Interface may be declared with the help of interface keyword and is implemented by using implements keyword .
⇒ A class may implements multiple interfaces and implementing class must override abstract methods.
Example of implementation of interface in java
interface Animal { void voice(); }
class Dog implements Animal { public void voice() { System.out.print("Bho Bho"); } }
class CheckMain { public static void main(String args[]) { Dog d1= new Dog(); d1.voice(); } }
Interface may be extended as following :
interface Animal{ void voice(); } interface WildAnimal extends Animal{ void speed(); }
class tiger implements WildAnimal { public void voice() { System.out.println("Gurr Gurr"); } public void speed() { System.out.println("70 km/hour"); } }
class CheckMain { public static void main(String args[]) { tiger t1=new tiger(); t1.voice(); t1.speed(); } }
Video/ C Introduction
Watch video in full size