Question:
How to define an Abstract class?
Answer:
A class containing abstract method is called Abstract class. An Abstract class can't be instantiated.
Example of Abstract class: abstract class testAbstractClass { protected String myString; public String getMyString() { return myString; } public abstract string anyAbstractFunction(); } Source: CoolInterview.com
A class that declares as abstract is called as abstract class. we can have an abstract class with no abstract mothods also. Source: CoolInterview.com
Answered by: Nagendra | Date: 11/11/2009
| Contact Nagendra
a class is called a abstract if it contain abstract methid and also if class implement any interface and it not implement(not write signature or body of any method) then it called abstract,and in this case the instance of class is not created,and if we not write abstract modifer above the class it give a compile time error, also if class is not abstract then we can also write a abstract modifer and it not give any error but it has no sense Source: CoolInterview.com
Answered by: Ashish Vyas | Date: 12/22/2009
| Contact Ashish Vyas
A class that declares as abstract is called as abstract class. we can have an abstract class with no abstract methods also
Best Example: public abstract class javax/servlet/http/HttpServlet Source: CoolInterview.com
Answered by: Sreenivasulu Reddy Peram | Date: 2/22/2010
| Contact Sreenivasulu Reddy Peram
Any class that contains one or more abstract methods must also be declared abstract. To declare a class abstract, you simply use the abstract keyword in front of the class keyword at the beginning of the class declaration. There can be no objects of an abstract class. Source: CoolInterview.com
Answered by: Irfan Ahmed | Date: 3/12/2010
| Contact Irfan Ahmed
Abstract is a keyword.It is used to declare class and method. Abstract class contain at least one abstract method and simple method also. Source: CoolInterview.com
Answered by: Jitendra Yadav | Date: 6/17/2010
| Contact Jitendra Yadav
If you have the better answer, then send it to us. We will display your answer after the approval.
Rules to Post Answers in CoolInterview.com:-
- There should not be any Spelling Mistakes.
- There should not be any Gramatical Errors.
- Answers must not contain any bad words.
- Answers should not be the repeat of same answer, already approved.
- Answer should be complete in itself.
|