Geeks Talk

Prepare for your Next Interview


Welcome to the Geeks Talk forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.

Difference between interface and abstract class? are they both same

This is a discussion on Difference between interface and abstract class? are they both same within the OOPS forums, part of the Software Development category; Interface is the framework for methods . where only mehod signature and there is no implementation of a method.In Interface every method is abstract method. In abstract class there abstract ...

Go Back   Geeks Talk > Software Development > OOPS
Register Blogs FAQ Tag Cloud Calendar Mark Forums Read

OOPS Object-Oriented Programming Concepts

Reply

 

LinkBack Thread Tools Display Modes
  #21 (permalink)  
Old 03-12-2009
Junior Member
 
Join Date: Mar 2009
Location: jaipur
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Jaiseedling is on a distinguished road
Re: Difference between interface and abstract class? are they both same

Interface is the framework for methods . where only mehod signature and there is no implementation of a method.In Interface every method is abstract method.
In abstract class there abstract method signature is available and which class extend this super
class has to implement this abstract method.
Reply With Quote
Sponsored Links
  #22 (permalink)  
Old 03-31-2009
Junior Member
 
Join Date: Mar 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
anujsaxena is on a distinguished road
Re: Difference between interface and abstract class? are they both same

1)Abstract class is a collection of abstract methods and concrete methods or only abstract methods or only concrete methods
Interface is a collection of only abstract methods
2)the members of the abstract class are public(default),protected,static
the members of interface are implicitly public
3)A class can inherit one or more interfaces but a class can inherit only one abstarct class
4)abstract class can add more functiuonality without destroying the child classes
in an interface..creation of additional functions will have an effect on its child class due to necessary implementation of interface methods in child class
Reply With Quote
  #23 (permalink)  
Old 03-31-2009
Junior Member
 
Join Date: Mar 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
anujsaxena is on a distinguished road
Re: Difference between interface and abstract class? are they both same

I love Jave
Reply With Quote
  #24 (permalink)  
Old 04-02-2009
Junior Member
 
Join Date: Mar 2009
Location: mysore
Posts: 25
Thanks: 9
Thanked 0 Times in 0 Posts
shilpamj is on a distinguished road
Re: Difference between interface and abstract class? are they both same

abstract class is a signature of class, can't be instantiated .
it having some abstract members(both variables and methods) which are get implemented in to derived classes
Interface is heaving all its methods (no any veriables) without implemented and all its methods are defaultly public because they all get implemented in derived classes but in abstract class only some its members may public

Last edited by shilpamj; 04-02-2009 at 08:53 AM.
Reply With Quote
  #25 (permalink)  
Old 04-12-2009
Junior Member
 
Join Date: Apr 2009
Location: Hyderabad,India
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
nandyalaajay2000 is on a distinguished road
Re: Difference between interface and abstract class? are they both same

1) abstract class may or maynot be contain abstract methods,but interfaces must contain abstract methods only
2)abstract class contains both abstract and concrete methods,concrete methods contain static,final and ordinary methods.
3)abstract class contains all concrete or all static methods or all final methods or all abstract methods or combination of all the above.
4)interface tells us what to do?,but not how to do
5)both abstract class and interface particpates in object creation through the concept of dynamic binding.
Reply With Quote
  #26 (permalink)  
Old 08-09-2009
Junior Member
 
Join Date: Aug 2009
Location: india
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
murali_yerukola is on a distinguished road
Re: Difference between interface and abstract class? are they both same

both are same but we can implements one or more at a time but we can extend one class at a time
Reply With Quote
  #27 (permalink)  
Old 09-27-2009
Junior Member
 
Join Date: Sep 2009
Location: hyderabad
Posts: 6
Thanks: 2
Thanked 0 Times in 0 Posts
jyothi85 is on a distinguished road
Re: Difference between interface and abstract class? are they both same

Interface:

>It contains only abstract methods .
>it contains only constants but not instance variables.

abstract:

>it contains some abstract methods or concrete methods .
>it contains only instance variables.
Reply With Quote
  #28 (permalink)  
Old 09-27-2009
Junior Member
 
Join Date: Sep 2009
Location: hyderabad
Posts: 6
Thanks: 2
Thanked 0 Times in 0 Posts
jyothi85 is on a distinguished road
Re: Difference between interface and abstract class? are they both same

hi

Is java predefined or user-defined language ??
Can u please help me out. thanq
Reply With Quote
  #29 (permalink)  
Old 4 Weeks Ago
Junior Member
 
Join Date: Oct 2009
Location: in chennai
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
winoth4 is on a distinguished road
Thumbs up Re: Difference between interface and abstract class? are they both same

Hi,

An interface is called as a pure abstract class where non abstract member functions are not allowed but in case of abstract classes we can have both abstract and non abstract member functions based on the requirement...
Reply With Quote
  #30 (permalink)  
Old 4 Weeks Ago
Junior Member
 
Join Date: Dec 2008
Location: Indore MP India
Posts: 7
Thanks: 0
Thanked 1 Time in 1 Post
amit.jain10 is on a distinguished road
Re: Difference between interface and abstract class? are they both same

a) All the methods declared inside an interface are abstract whereas abstract class must have at least one abstract method and others may be concrete or abstract.

b) In abstract class, key word abstract must be used for the methodsWhereas interface we need not use that keyword for the methods.

c)Abstract class must have subclasses whereas interface can’t have subclasses.
Reply With Quote
Reply

  Geeks Talk > Software Development > OOPS

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads

Thread Thread Starter Forum Replies Last Post
Real time example for abstract class and interface Geek_Guest Java 4 04-15-2009 08:20 AM
difference between abstract class and interface manipalreddy.s Java 12 10-25-2007 07:06 AM
Is there any benefit to extend both Interface and abstract class Geek_Guest Java 1 06-08-2007 01:54 PM
Confusion with ABSTRACT and INTERFACE Geek_Guest Java 2 05-07-2007 04:38 AM
Difference between Remote & Serializable interface Geek_Guest Java 1 04-02-2007 11:15 AM


All times are GMT -4. The time now is 06:46 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.3.1
Copyright © 2009 GeekInterview.com. All Rights Reserved