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...

what is the difference between abstract class and
Interface?where we can use it in realtime projects?

Answer Posted / chitij mehrotra

1 A class may inplement several interfaces. A class may
extend only one abstract class.
2 An interface can have only abstract methods. An abstract
class can have both abstract methods and concrete methods.
At one abstract method in the abstract class.
3 Interfaces cannot have constructors. Abstract class can
have constructors.
4 Only static final variables are allowed to be decelared.
Both static and instance variables are allowed.
5 All decelared methods are implicitly public. Can have any
kind of methods.
6 We should initialize variables in an interface. Not
necessary to initialize variables in an abstract class.
7 In the case of interface you can make any class in the
hierarchy. In the case of abstract class you know the class
hierarchy in advance.
8 An interface implementation may be added to any existing
third party class. A third party class must be rewritten to
extend only from the abstract class.
9 Interfaces can be implemented by classes that are not
related to one another Abstract classes are used only when
there is a “is-a” type of relationship between the classes.

Is This Answer Correct ?    54 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What does @param args mean in java?

1051


What about static nested classes in java?

1131


Why is singleton instance static?

990


What is anagram in java?

923


What is a prefix function.write down a code to compute prefix function.

1052


Can string be considered as a keyword?

1029


what is singleton in java?

1042


What is the difference between the prefix and postfix forms of the ++ operator?

1014


Why we cannot override static method?

1052


What are the types of literals?

1171


what is the purpose of the wait(), notify(), and notifyall() methods? : Java thread

981


Why collection is called framework in java?

982


What is this keyword used for?

1111


What is a local, member and a class variable?

1033


How do you get length in java?

1024