14/04/2008
A class containing atleast one abstract method is called an abstract class. A method that has no implementation and which is expected to be implemented by a subclass is called an abstract method. An Abstract class cannot be instantiated. It is expected to be extended by a subclass. An abstract class may contain static variables declared. Any class with an abstract method must be declared explicitly as abstract. A class may be declared abstract even if it has no abstract methods. This prevents it from being instantiated.














This site is very good and simple. I do have a question here. The first line says – “A class containing atleast one abstract method is called an abstract class” –
Isn’t it incorrect?
However in the last line you have mentioned clearly that abstract class may not have an abstract method.
regards,
Prasanth on May 20th, 2010 10:35 amprasanth
The abstract class may or may not have the abstract method. But if you have any abstract method then the class should be Abstract.
UnKnown on June 30th, 2010 11:36 pm1. A class containing atleast one abstract method is called an abstract class.
2. A class may be declared abstract even if it has no abstract methods.
?????…
Anonymous on July 6th, 2010 10:03 amcan abstract class have constructor ?
ankitagahoi on December 4th, 2010 7:14 pmAn abstract class is simple a class which cant be instantiated.
gaurav prajapati on December 22nd, 2010 2:18 pmAn abstract method defined within an abstract class must be implemented by all of its subclass.
Abstract method cannot be instantiated,it is generally used for inherited.
An abstract class may or may not have abstract methods.
public abstract class AAA
{
}
Bibhudutta Pradhan.
Anonymous on April 2nd, 2011 4:06 pmAn abstract class may or may not have abstract methods.
public abstract class AAA
Bibhudutta Pradhan. on April 2nd, 2011 4:07 pm{
}
public abstract class AAA
{
// Nothing inside
}
This compiles absolutely fine.
Found a list of Abstract Class FAQ:
- Must abstract classes contain at least one abstract method?
- Can a static method be abstract?
- Why can’t an abstract method be declared private?
Q:How can I declare a constructor for an abstract class?
http://techguru.yakkoo.com/programming-concept-tutorials/2011/08/what-is-an-abstract-class-complete-reference/
danish on August 10th, 2011 7:07 amHi Joe,
Initially you said[first sentance of this topic], an abstract class should have atleast one abstract method. This is wrong know? It can have only instance methods as you mentioned at last.
Thanks,
Sharat on March 8th, 2012 6:29 pmSharat