GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

GeekInterview.com  >  Tech FAQs  >  Programming  >  Java
Go To First  |  Previous Question  |  Next Question 
 Java  |  Question 6 of 875    Print  
What is the difference between abstract class & Interface.

  
Total Answers and Comments: 11 Last Update: February 21, 2007   
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
  Sorting Options  
  Page 1 of 2   « First    1    2    >     Last »  
July 18, 2005 07:31:14   #1  
arunapratap_k        

RE: What is the difference between abstract class & Interface.
ABSTRACT CLASS contains general methods aswell as abstract methods whereas INTERFACE contains only abstract methods. 
A programmer uses Abstract class to specify the common features of all objects 
and abstract methods when the methods have diff. implementations for diff. objs. 
he himself writes the classes implementing abstact methods. 
A programmer writes an Interface when he doesn't know how to implement the features of a s/w and he leaves the implementation to be provided by 3rd party vendors

 
Is this answer useful? Yes | No
August 10, 2005 10:25:34   #2  
padmareddy        

RE: What is the difference between abstract class & Interface.
what is clone interface 

 
Is this answer useful? Yes | No
August 13, 2005 08:17:29   #3  
M.Manikumar        

RE: What is the difference between abstract class & Interface.
An abstract class contain both abstract and concrete methods where as an interface contains only abstract methods.
 
Is this answer useful? Yes | No
August 28, 2005 04:16:34   #4  
Sachin        

RE: What is the difference between abstract class & Interface.
interfac is 100 % abstract class.All the methods in interface is implictly abstract.interface does not hava body.But in Abstract class there must be one method to be concrete itself
 
Is this answer useful? Yes | No
September 26, 2005 02:24:56   #5  
jeet        

RE: What is the difference between abstract class &am...
interfaces are 100% abstract entities. they must have all methds having no body(abstract methods), while in abstract classes , its not necessary to have any abstract method. it can have or it might not have.
 
Is this answer useful? Yes | No
September 26, 2005 03:31:27   #6  
kranthi        

RE: What is the difference between abstract class &am...

in interface all the methods should be declared as abstract

in abstact class all methods need not be declared as abstract and if we do not provide the implementations of all the methods of the abstract class the class that extends this class should be declared as abstract


 
Is this answer useful? Yes | No
September 26, 2005 14:31:51   #7  
Masthan        

RE: What is the difference between abstract class &am...

    In interface all data members are final and static means they wont be  changed and can be called by using classname and "." operator and we can provide multiple inheritance which is  not possible in the case of abstract classes.abstract classes contains general methods as well as abstract methods.


 
Is this answer useful? Yes | No
October 02, 2005 22:25:27   #8  
sathish        

RE: What is the difference between abstract class &am...
RE: What is the difference between abstract class &am...
 
Is this answer useful? Yes | No
October 08, 2005 15:29:02   #9  
Aashish Renapurkar        

RE: What is the difference between abstract class &am...
Choosing interfaces and abstract classes is not an either/or proposition. If you need to change your design, make it an interface. However, you may have abstract classes that provide some default behavior. Abstract classes are excellent candidates inside of application frameworks. Abstract classes let you define some behaviors; they force your subclasses to provide others. For example, if you have an application framework, an abstract class may provide default services such as event and message handling. Those services allow your application to plug in to your application framework. However, there is some application-specific functionality that only your application can perform. Such functionality might include startup and shutdown tasks, which are often application-dependent. So instead of trying to define that behavior itself, the abstract base class can declare abstract shutdown and startup methods. The base class knows that it needs those methods, but an abstract class lets your class admit that it doesn't know how to perform those actions; it only knows that it must initiate the actions. When it is time to start up, the abstract class can call the startup method. When the base class calls this method, Java calls the method defined by the child class. Many developers forget that a class that defines an abstract method can call that method as well. Abstract classes are an excellent way to create planned inheritance hierarchies. They're also a good choice for nonleaf classes in class hierarchies.
 
Is this answer useful? Yes | No
April 18, 2006 06:02:20   #10  
radhey Member Since: April 2006   Contribution: 3    

RE: What is the difference between abstract class &am...

abstract class has at least one method abstract and it has more than one method abstract and that method should be implemented by the class.

In case of Interface it should be all method abstract bydefault and it necessary to implemented.If programmer implements all the method of the class then he uses the interface and interface is a keyword in java.


 
Is this answer useful? Yes | No
  Page 1 of 2   « First    1    2    >     Last »  


 
Go To Top


 Sponsored Links

 




About Us  |   Privacy Policy  |   Terms and Conditions  |   Contact  |   Site Map  |   Add Question  |   Propose Category  |   RSS Feeds  |   Articles Sitemap  |   Site Updates  |   Add Resource

Copyright © 2005 - 2008 GeekInterview.com. All Rights Reserved
Page copy protected against web site content infringement by Copyscape