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
Why do we override tostring method in java?
How is Object Oriented Programming different from Procedure Oriented Programming?
worst case complexities of Quick sort and Merge sort.
Is vector thread safe in java?
Can a serialized object be transferred via network?
why an outer class cannot be declared as private?
How the metacharacters are different from the ordinary characters?
Explain access modifiers in java.
What is the purpose of using break in each case of switch statement?
Can we call the constructor of a class more than once for an object?
what are three ways in which a thread can enter the waiting state? : Java thread
Why is java multithreaded?
Which method returns the length of a string?
How hashset works internally in java?
Where is core java used?