does abstract class without abstract method?

India
April 9, 2007 12:18am CST
In Abstract Class is it possible to be without abstract method? I knew only that if in a class any method is abstract then that class must be abstract.
2 responses
@iamcrazy (32)
• India
12 Apr 07
Its not necessary for an abstract class to have an abstract method, Abstract class can be defined just for the sake that no body instantiates the object of that class.
@julie111 (44)
11 Apr 07
For a class to be abstract it must contain atleast one abstract method. otherwise it will give compile time error. Consider an example below: //A simple demo of abstract class abstract class A { abstract void callme(); //concrete methods still allowed in abstract classes void callmetoo() { System.out.println("This s 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(); } } in the example class A declared abstract so it should contain an abtract method(missing body). And the class which inherits the abstract class should implement the abstract method as the class B does.