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

Difference between Abstract Class & Interface?

Answer Posted / adikeanand@gmail.com

ABSTRACT CLASS:
1)abstract class contains abstract methods with body and concrete methods also.
2) when a class contains abstract methods declare the class as abstract.
3) when we don't want to allow anybody to create object to the class then declare class as abstract.when we want to use the methods of a abstract class write a class which extends abstract class and create reference variable to abstract class and assign subclass object.
4)We can not create object to the abstract class but we can create reference variable.

INTERFACE:
1)Interface contains abstract methods and static final data.
2)when we are writing a class which implementing interface then we have to provide the body for all the abstract methods of interface.
3)If we don't want to provide all the methods of interface then declare the class as abstract.write the class which extends abstract class and write the methods which you have left abstract methods and create reference variable to interface and assign the object of class which extends abstract class.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between a jdk and a jvm?

852


What is microservices java?

835


What is jep in java?

818


Why doesn't lsdou work under windows nt? : java security

818


What is a java proxy?

891


I am trying to create a new universal user group. Why can't i? : java security

869


What is a jvm?

889


What is factory pattern in java?

843


What is property file in java?

838


what is the package for freshers in valuelabs.

6093


Can the main method be overloaded?

910


How common are security breaches? : java security

900


I run a web server. Am I at risk? : java security

838


Which is better openjdk or oracle jdk?

818


What is java net url?

781