what is Abstract class

Hello what is Abstract class
[35 byte] By [christianjasona] at [2007-9-28 6:59:30]
# 1
this is a abstract class public abstract class Myab { public Myab() { } public abstract void MyabFunction();}
xbo_a at 2007-7-9 18:10:15 > top of Java-index,Archived Forums,New To Java Technology Archive...
# 2

An abstract class is a class that can have one or more abstract methods in it.

An abstract method is a method that does not have a body. Only the signature is declared, leaving it up to a subclass to implement the method.

An often used example of this would be the abstract class shape, representing a two dimensional shape (for instance a circle or a square). This class has an abstract method getArea(), which gets you the size of the surface.

The implementation of this method would be something like returning Math.PI * radius * radius for the circle, while returning side * side for the square.

So while you can't do something like Shape s = new Shape(), you can do Shape s = new Square() and int x = s.getArea() after that.

SQBa at 2007-7-9 18:10:15 > top of Java-index,Archived Forums,New To Java Technology Archive...