Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


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?

Answers were Sorted based on User's Feedback



There can be a abstract class without abstract methods, but what is the need to declare a class ab..

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

There can be a abstract class without abstract methods, but what is the need to declare a class ab..

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

There can be a abstract class without abstract methods, but what is the need to declare a class ab..

Answer / srinidhi a.p

Abstract classes are a type of helper classes. i.e., they
help some other class to complete its job.
So, if there is no methods specified, then the instance or
static variables can serve something for other class which
extends it.

Is This Answer Correct ?    1 Yes 3 No

There can be a abstract class without abstract methods, but what is the need to declare a class ab..

Answer / keerthi

It is used prevent creating object of abstract class.

Is This Answer Correct ?    2 Yes 5 No

There can be a abstract class without abstract methods, but what is the need to declare a class ab..

Answer / zartab

An abstract class when declared, any method declared inside it becomes implicitly abstract and hence any class extending it have to provide deferred implementation.

Is This Answer Correct ?    2 Yes 14 No

Post New Answer

More Core Java Interview Questions

How to convert a string to long?

2 Answers  


Is java hashset ordered?

0 Answers  


What are Transient and Volatile Modifiers?

3 Answers   SAP Labs, TUP Manila,


Can we write any code after throw statement?

0 Answers  


What is basic syntax?

0 Answers  


What is a superclass?

0 Answers  


What are keywords in programming?

0 Answers  


How many ways can an argument be passed to a subroutine and explain them?

0 Answers  


What are void methods?

0 Answers  


How would overload a function based on return type?

0 Answers   Genpact,


Why chararray() is preferred over string to store the password?

0 Answers  


Which collection is sorted in java?

0 Answers  


Categories