Search This Blog

12 March, 2011

A Java program using abstarct keyword

A Simple demonstration of ........ abstract keyword ..........



abstract class A
 { 
abstract void callme();
 
// concrete methods are still allowed in abstract classes
 
void callmetoo()
 { 
System.out.println("This is a concrete method.");
 
}
 
}
class B extends A
 { 
void callme()
 { 
System.out.println("B's implementation of callme.");
 
}
 
}
class AbstractDemo
 { 
public static void main(String args[])
 { 
B b = new B();
 
b.callme();
 
b.callmetoo();
 
}
 
}

-------------------------------------------------------------------------------------



No comments:

Post a Comment

Meetme@