There can be a abstract class without abstract methods, but
what is the need to declare a class abstract if it doesn't
contain abstract methods?
Answer Posted / ram
We will get an additional facility in using abstract classes over interfaces is, in abstract class if we add a new method, in its child classes we need not implement those newly added methods as it is non-abstract method and has default implementation in the abstract class definition. But whereas if we add a new method (abstract) in the interface, in all its implemented classes needs to implement this newly added method which leads to many changes which is violating one of the design principle – Open for extension Closed for modification.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is bufferedreader in java?
why are wait(), notify() and notifyall() methods defined in the object class? : Java thread
What are constants and how to create constants in java?
What does @param args mean in java?
How are variables stored?
Explain tree set and its features?
Can we rethrow the same exception from catch handler?
Which methods are used during serialization and deserialization process?
Why string objects are immutable in java?
Why is it important to initialize a variable?
Give any two differences between C++ and java.
What is a singleton puppy?
What are the two ways of implementing multi-threading in java?
What is the difference between path and classpath variables?
When is update method called?