what is main purpose of abstract class?
Answers were Sorted based on User's Feedback
Abstract class is used to implement common behavior which is
required by all subclasses but have some behavior which is
specific to subclass.
E.g., you want to implement a DocumentViewer App. Basic
operations are like open, view and close. open and close
requires no specific implementation while view require
specific implementation. Make DocumentViewer abstract,
implement open, close and make view as abstract. Now view is
responsibility of subclass. Like PDFViewer will have own
implementation for view()
| Is This Answer Correct ? | 14 Yes | 1 No |
Answer / rakesh@crr
if a class contains abstract method,that class must be
declared as a abstract class. abstract methods contains only
declarations. it does not contain objects.
| Is This Answer Correct ? | 16 Yes | 12 No |
Answer / surendra
Abstract classes are use to give functionality to the users.
The functionality is given by the class, use use this
functionality as per his/her requirements. Abstract classes
gives additional functionality to put one or two methods
common for each user and may put others abstract to fullfill
users requirements.
| Is This Answer Correct ? | 5 Yes | 2 No |
Answer / sumanth gatla
there is no rule that an abstract class must contain one
abstract method. with out single abstract method also
abstract class exist
eg........HTTPServlet
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / harshavardhan
In Inheritance , class become more general and more
abstract.Ancestor classes are more general, i.e more basis
for other classes.Abstract classes can have fields and
concrete methods.Methods are declared not defined so we can
not create objects. but we can create object variables of an
abstract class. but such variable must refer to an object of
a nonabstract subclass.
| Is This Answer Correct ? | 0 Yes | 4 No |
Answer / venkatesh
abstract class have atleast abstract method
it is maily used for to prevent create object of class.
| Is This Answer Correct ? | 2 Yes | 8 No |
What is the full name of java?
What is downcasting?
What is the use of http-tunneling in rmi?
How do you implement singleton class?
What is java class writing rules?
how to create multithreaded program? Explain different ways of using thread? When a thread is created and started, what is its initial state? Or extending thread class or implementing runnable interface. Which is better? : Java thread
Is simpledateformat safe to use in the multithreaded program?
Difference between abstract class and Interfaces?
7 Answers CTS, iFlex, PA Consulting, Sai Softech, Value Chain,
Draw a UML class diagram for the code fragment given below: public class StringApplet extends Applet { private Label sampleString; private Button showTheString; private ButtonHandler bHandler; private FlowLayout layout; public StringApplet() { sampleString = new Label(" "); showTheString = new Button (" Show the String"); bHandler = new ButtonHandler(); layout = new FlowLayout(); showTheString.addActionListener(bHandler); setLayout(layout); add(sampleString); add(showTheString); } class ButtonHandler implements ActionListener { public void actionPerformed(ActionEvent e) { samplestring.setText("Good Morning"); } } } Note: The methods need not be indicated on the diagram.
Can a class inherit the constructors of its superclass?
In method overloading ,if i change the return type to Long instead of INT,is the program execute
What is e in java?