what is main purpose of abstract class?

Answer Posted / amit patel

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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is stringjoiner ?

573


What is __ init __ functions?

543


Can we extend a class with private constructor?

522


How can we create a synchronized collection from given collection?

577


How do you start a thread?

546






Can private method static?

471


How is it possible in java programming for two string objects with identical values not to be equal under the == operator?

560


How is string immutable in java?

539


Is java 9 released?

519


Explain the scope of a variable.

627


What is meant by main method?

577


What is the purpose of a default constructor?

576


Can we serialize arraylist in java?

538


What is the exact difference in between Unicast and Multicast object?

1504


What is the use of protected in java?

532