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
What access modifiers can be used for methods?
what is difference betweem home interface and remote interface?
Name few "optional" classes introduced with java 8 ?
We are seeing so many videos/audios as many web sited. But question is these videos or audios are stored in Databases ( Oracle, Mysql, Sybase,... ) or stored any file directory from there they will give the link for that? Pls explain and give sample code to achieve this one? Thanks, Seenu.
Can we extend a class with private constructor?
What is the static variable?
How will you get the platform dependent values like line separator, path separator, etc., ?
What is the use of jtable?
Can we declare an array without size in java?
Is java 9 released?
What is a qualifier in a sentence?
What is purpose of find feature?
Is null or empty java?
what is a working thread? : Java thread
What is the advantage of preparedstatement over statement?