Monday, 12 October 2015

Abstract class example 2


public class First {

public static void main(String[] args) {
// TODO Auto-generated method stub
Third obj = new four();
obj.First();
obj.like();
obj.display();
}

}


public class Second {
void display(){
System.out.println("Testing display");
}
}

abstract class Third extends Second{
abstract void First();
void like(){
System.out.println("like");
}
}

class four extends Third{
void First(){
System.out.println("Testing Third Display");
}
}

output:-
Testing Third Display
like
Testing display

No comments:

Post a Comment