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

Is there a case when finally will not execute?

559


What is an enumeration?

562


What is integer size in java?

499


Is null a keyword in java?

549


Can a variable be local and static at the same time?

534






Explain what pure virtual function is?

585


What is the functionality of the stub?

563


Explain the difference between collection api and stream api in java8?

501


Is array primitive data type in java?

525


How many java versions are there?

556


Why we go for collections in java?

536


What are thread priorities and importance of thread priorities in java?

620


Why can't we use static class instead of singleton?

494


what is method reference in java 8?

548


Hi i am creating desktop application in that i want calling to mobile number. i have java telephone api (JTAPI) but i dont understand how it configure & use plese help me

1354