Thursday, 11 February 2016

Java Tutorial : Java abstract class(implements interface)


Click here to watch in Youtube :
https://www.youtube.com/watch?v=PoJB6AoM-Dc&list=UUhwKlOVR041tngjerWxVccw

Click the below Image to Enlarge
Java Tutorial : Java abstract class(implements interface)
Person.java
public interface Person
{
    public void walk();

    public void eat();
}

abstract class Employee implements Person
{

}

class EmployeeImpl extends Employee
{

    @Override
    public void walk()
    {
        System.out.println("walking");
    }

    @Override
    public void eat()
    {
        System.out.println("eating");
    }

}
AbstractClassTest.java
public class AbstractClassTest
{

    public static void main(String[] args)
    {
         Person personRef = new EmployeeImpl();
         personRef.eat();
         personRef.walk();
         
         System.out.println("-------------------------");
         
         Employee employeeRef = new EmployeeImpl();
         employeeRef.eat();
         employeeRef.walk();
    }

}
Output
eating
walking
-------------------------
eating
walking
Click the below link to download the code:
https://sites.google.com/site/javaee4321/java/AbstractClassDemo_Interface_App.zip?attredirects=0&d=1

Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava/AbstractClassDemo_Interface_App

Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/cca1e1df516bcb14a74fa137b20f412f56eb3b59/BasicJava/AbstractClassDemo_Interface_App/?at=master

See also:
  • All JavaEE Viedos Playlist
  • All JavaEE Viedos
  • All JAVA EE Links
  • Servlets Tutorial
  • All Design Patterns Links
  • JDBC Tutorial
  • Java Collection Framework Tutorial
  • JAVA Tutorial
  • No comments:

    Post a Comment