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  >  Interview Questions  >  J2EE  >  Java
Go To First  |  Previous Question  |  Next Question 
 Java  |  Question 230 of 921    Print  
What is the difference between Abstract class and Interface

Answered by Scott on 2005-05-12 10:03:06: An abstract class can contain non-abstract methods which do not have to be overridden in the subclass. 
 
There is no difference between a fully abstract class (all methods declared as abstract and all fields are public static final) and an interface.



  
Total Answers and Comments: 23 Last Update: April 28, 2008   
  
 Sponsored Links

 
 Best Rated Answer
Submitted by: Nandesh
 
what do you mean by marker?

Above answer was rated as good by the following members:
neeraj maurya
  Sorting Options  
  Page 1 of 3   « First    1    2    3    >     Last »  
May 12, 2005 10:03:06   #1  
Scott        

RE: What is the difference between Abstract class and Interface
An abstract class can contain non-abstract methods which do not have to be overridden in the subclass. 
 
There is no difference between a fully abstract class (all methods declared as abstract and all fields are public static final) and an interface.

 
Is this answer useful? Yes | No
July 26, 2005 05:22:13   #2  
Mayank        

RE: What is the difference between Abstract class and Interface
A class implementing an interface must implement all of the methods defined in the interface, while a class extending an abstract class need not implement any of the methods defined in the abstract class. Additionally, a class extending an abstract class can implement an infinite number of it's own methods.
 
Is this answer useful? Yes | No
January 19, 2006 08:02:54   #3  
Buddhadev Dasgupta        

RE: What is the difference between Abstract class and ...

another key difference between abstract class and interface is that , in abstract class we can put sharable code, but that is not possible in case of interface.

Another key difference between abstract class and interface is that,

We can use interface as marker, ( we can use abstract class also as abstract but then we can't extends any oter class, so it is better always use interface as marker)


 
Is this answer useful? Yes | No
January 24, 2006 23:46:52   #4  
PATIL SHIVAJI KISAN        

what is the difference between abstraction and encapsulation

what is the difference between abstraction and encapsulation?


 
Is this answer useful? Yes | No
February 20, 2006 23:37:36   #5  
Nandesh        

RE: What is the difference between Abstract class and ...
what do you mean by marker?
 
Is this answer useful? Yes | NoAnswer is useful 1   Answer is not useful 0Overall Rating: +1    
April 18, 2006 06:27:02   #6  
Ram        

RE: what do you mean by marker?
        An interface having no methods is called as a Marker Interface.
 
Is this answer useful? Yes | No
May 12, 2006 22:02:15   #7  
Prasanth        

RE: What is the difference between Abstract class and ...
Abstract class does not support Multiple Inheritance . Interface supports Multiple Inheriatnce..
 
Is this answer useful? Yes | No
July 17, 2006 05:11:24   #8  
yugandhar        

RE: What is the difference between Abstract class and ...
marker is nothing but like an indication, which means it says some intimation to the JAM or Container. For example, we want to store an object in the file then we have to intimate to the compiler that this object should be stored. This intimation can be done by implementing the interface java.io.Serializable.
 
Is this answer useful? Yes | No
August 24, 2006 04:54:32   #9  
varun mittal        

RE: What is the difference between Abstract class and ...
The differnce is that in interface all are public but in abstract class u can have private and protected members
 
Is this answer useful? Yes | No
September 21, 2006 05:23:05   #10  
Rupesh        

RE: What is the difference between Abstract class and ...

All I know is that interface is a contract and abstract class is for generalization but I could not understand when to use abstract class and when to use interface?

Can anyone explain with example?

 

 


 
Is this answer useful? Yes | NoAnswer is useful 0   Answer is not useful 1Overall Rating: -1    
  Page 1 of 3   « First    1    2    3    >     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