what is abstract class?

Hi, What is abstract class? How can we create an abstract class?Pooja.
[98 byte] By [_Poojaa] at [2007-10-3 1:13:25]
# 1

Hi pooja,,

u r under the topic Jsp, not core java.

post ur qureies out there..

here is the ansewer.

->Abstract Class.

A class which contains a pure abstract method is called abstract class.

You cannot create object from abstract class.

Any class extends the abstract class has to define the body for the abstract method defined in the abstract class, else declare that class also abstract.

->How to declare?

use the 'abstract' keyword.

Best solution.

Refer a book for core java.

Suresh_hia at 2007-7-14 18:10:31 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

abstract class is the class that contains some methods with out the implementation (method header without implementaion) and it is not possible to instatiate object from this class , in the other side u have concrete class with is the normal one ( method headr and implementation) here is the sytax:

public abstract class_name

{

public return_data_type method_name (patameter list)

{} //this method has implementation

public return_data_type method_name (patameter list);

//this method has not implementation

}

nouresa at 2007-7-14 18:10:31 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3

abstract class is the class that contains some methods with out the implementation (method header without implementaion) and it is not possible to instatiate object from this class , in the other side u have concrete class with is the normal one ( method headr and implementation) here is the sytax:

public abstract class_name

{

public return_data_type method_name (patameter list)

{} //this method has implementation

public return_data_type method_name (patameter list);

//this method has not implementation

}

nouresa at 2007-7-14 18:10:31 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4

according to me

abstract classes can or not have the method implementation

as in interfaces

but abstract class can contain method bodies/implementation that is

this class can provide the basic functioning of the method and let the concrete class impement the extended functionality.

Thanks

MaheshP.

MaheshPa at 2007-7-14 18:10:31 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 5

Suresh_hi,

> You cannot create object from abstract class.

Check this statement...You can create object of an abstract class but objects of that class almost have no meaning. That is, it is meant to express only the interface, and not a particular implementation, so creating an object of a class makes no sense.

Try to read Thinking in Java by Bruce Eckel...

omen,

omena at 2007-7-14 18:10:31 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 6
public abstract class ABSDemo{public void main(String s){System.out.println(s);}}is an abstract class ?Pooja
_Poojaa at 2007-7-14 18:10:31 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...