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


Please Help Members By Posting Answers For Below Questions

State the difference between strings and arrays.

601


Can you access non static variable in static context?

559


What is a java developer salary?

544


What is gui programming?

520


What is the difference between an if statement and a switch statement?

650






What is a “stateless” protocol ?

558


What is a class in java?

580


What are the two environment variables that must be set in order to run any java programs?

531


How to change the priority of thread or how to set the priority of thread?

617


What are the important features of Java 11 release?

582


Why is singleton class used?

527


Is java good for beginners?

582


What is the difference between a static and a non-static inner class in java programming?

533


How does predicate work in java?

536


In which language java is written?

539