Tuesday, 16 February 2016

Java Tutorial : When to use Java abstract class and abstract method


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

Click the below Image to Enlarge
Java Tutorial : When to use Java abstract class and abstract method 
Car.java
abstract class Car
{
    abstract void engine();
}

class HondaCar extends Car
{

    @Override
    void engine()
    {
        System.out.println("Honda Car Engine Implementation...");
        // Honda Car implementation

    }

}

class SwiftCar extends Car
{

    @Override
    void engine()
    {
        System.out.println("Swift Car Engine Implementation...");
        // Swift Car implementation
    }

}
AbstractClassTest.java
public class AbstractClassTest
{

    public static void main(String[] args)
    {
        Car carRef = new HondaCar();
        carRef.engine();
        
        carRef = new SwiftCar();
        carRef.engine();
    }

}
Output
Honda Car Engine Implementation...
Swift Car Engine Implementation...
Click the below link to download the code:
https://sites.google.com/site/javaee4321/java/AbstractClassDemo_when_to_use_App.zip?attredirects=0&d=1

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

Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/d0d6b1dff9f31bbeec3615564d292efcb8f01f3f/BasicJava/AbstractClassDemo_when_to_use_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

    Google+ Followers

    Google+ Badge