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 / gkp

Abstract class and Interface are the design time decision. As we expect to extend our implementation in future so we need to give space to incorporate new implementation. As we know if some implementation of a method will be common in many classes then that method should be moved to abstract class so the repetition of same code can be avoided. Even though we don't have any abstract method in our abstract class, we can go for a abstract class. Generally in design of java classes, it is designed like, first an interface then an abstract class and then concrete class implementation starts.

Is This Answer Correct ?    5 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is use of super keyword?

565


What is the driver class?

564


Can final class have constructor?

490


What is size () in java?

537


What is the static field modifier?

590






Is array passed by reference in java?

571


What is the super void?

450


What is qualitative variable?

514


Can we override data members in java?

617


placement papaers of spring computing technology

1019


Is it possible to use string in the switch case?

546


What is a final class ?

595


How to display all the prime numbers between 1 and n (n is the number, get the input from user)

506


What does it mean to be immutable?

539


What is synchronization and why is it important in java programming?

468