• RELEVANCY SCORE 5.65

    DB:5.65:Abstract Class 13




    Difference between abstract class and interface
    use of abstract class

    DB:5.65:Abstract Class 13

    This question has been asked here about a billion times:

    http://search.java.sun.com/search/java/index.jsp?qt=interfacenh=10qp=st=11rf=0since=country=language=charset=variant=col=javaforums

  • RELEVANCY SCORE 5.43

    DB:5.43:Difference Between Inheritance And Abstract Class 9s




    difference between inheritance and abstract class

    DB:5.43:Difference Between Inheritance And Abstract Class 9s

    There was never an episode of Blackadder where he tried to con his aunt out of an abstract class

  • RELEVANCY SCORE 4.93

    DB:4.93:C#.Net Difference Between Abstract Class And Sealed Class df




    Hi Experts, What is Difference Between Abstract Class And Sealed Class in C#? Thanks.

    Knowledge Shared Is Knowledge Gained

    DB:4.93:C#.Net Difference Between Abstract Class And Sealed Class df

    Hi Geert van Horrik, Thanks.Knowledge Shared Is Knowledge Gained

  • RELEVANCY SCORE 4.75

    DB:4.75:Difference Between A Abstract Class With 4 Abstract Methods And A Interface With 4 Abstract Methods. 8c


    what is the difference between Difference between a Abstract class with 4 abstract methods and a Interface with 4 abstract methods.

    DB:4.75:Difference Between A Abstract Class With 4 Abstract Methods And A Interface With 4 Abstract Methods. 8c

    Your question is better rephrased as: What is the difference between an abstract class and a interfase?
    This has been discused here
    http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/67451957-f0bd-4b9b-a2c0-16f604ce8643
    Regards

  • RELEVANCY SCORE 4.68

    DB:4.68:Abstract Class af


    I made one abstract class called Person and another normal extended class Student of Person;
    Then i made abstract method called add(Student s) also i includes same method in extended class.

    How can we encapsulate data?

    What's the main reason to be abstracted?

    DB:4.68:Abstract Class af

    Of this is just great. Now I can't get my "BDLH and Seven of Nine alone on the holodeck" fantasy out of my head.

  • RELEVANCY SCORE 4.59

    DB:4.59:Difference Between The Normal Class And Standard Class In Change Management 3s



    Hi All,

    Can anyone please tell me the functional difference between the Normal Class and Standard class in change management console, as i could not find any difference.

    Thanks in advance,

    Satish

    DB:4.59:Difference Between The Normal Class And Standard Class In Change Management 3s


    sometimes to know the generic definitions of these widely used change management process terms which are there in the tool even ITIL can also fetch that info apart from our user guides..

    http://www.ucisa.ac.uk/~/media/Files/members/activities/ITIL/servicetransition/chanage_management/ITIL_a%20guide%20to%20change%20management%20pdf

  • RELEVANCY SCORE 4.55

    DB:4.55:Re: Different Between Abstract Class And Interface 77


    any one can please tell me Difference between
    abstract class and interface. From a typing perspecitive there's no difference (you can declare variables of both). The only difference in principle is that an abstract class also can have concrete methods so it allows you ti inherit implementation along with the type. You can only inherit from one class but from as many interfaces you whish.

    Which one is best ?The short answer is that interface is best.

    DB:4.55:Re: Different Between Abstract Class And Interface 77

    Hi,please kindly help meWell, maybe if you'd post an actual question...

  • RELEVANCY SCORE 4.55

    DB:4.55:Difference 7x


    Hi sirs,
    Give me the main differences between abstract class and interface.Dont give me the links sir,

    when we go to use for the interface and for abstract class in developing an application

    DB:4.55:Difference 7x

    Another link:
    {color:#0000ff}http://forum.java.sun.com/thread.jspa?messageID=9961601{color}

    db

  • RELEVANCY SCORE 4.55

    DB:4.55:Differance Between Abstract Class And Interface 7s


    Whats the main differance between abstract class and Interface and where I can use abstract class and where I can use Interface

    DB:4.55:Differance Between Abstract Class And Interface 7s

    Refer to
    http://www.javaworld.com/javaworld/jw-09-2001/jw-0921-interface.html

  • RELEVANCY SCORE 4.46

    DB:4.46:Difference Between Abstract Class And An Interface c3


    hi all,

    what is the difference between an ABSTRACT CLASS with full of METHOD DEFINITIONS and no implemented methods. AND an interface having the same definitions.

    In which situation we use abstract class and in which situation we use interface.

    what are the benefits.

    Can anybody explain it clearly.

    bye
    -hari

    DB:4.46:Difference Between Abstract Class And An Interface c3

    http://www.google.com/search?q=java+difference+abstract+interfaceTrying to teach a man to fish, are you?

  • RELEVANCY SCORE 4.45

    DB:4.45:Abstract And Interface fa


    Dear Sir/Madam,

    Please let me know the difference between Abstract class and Interface.

    DB:4.45:Abstract And Interface fa

    I disappeared as i was checking the forums in javaworld.com, but now i will keep this site as main.

  • RELEVANCY SCORE 4.45

    DB:4.45:Interface fd


    can any one tell me what is the actual difference between an abstarct class and interface.when do we use interface and when do we use abstract class in real time environment?

    DB:4.45:Interface fd

    don't encourage this nonsense

  • RELEVANCY SCORE 4.40

    DB:4.40:Difference Between Abstract Class And Interface j3


    What is the difference between anabstract class and aninterface ?

    DB:4.40:Difference Between Abstract Class And Interface j3

    Hi,
    Check this link differencebetween an abstract class and an interfacePS.Shakeer Hussain

  • RELEVANCY SCORE 4.40

    DB:4.40:Subclass Vs Concrete Class fs


    Hi,

    What is the exact difference between subclass and concrete class?

    What is the need in subclassing abstract class to again abstract class?

    Thanks in Advance,
    venu.

    DB:4.40:Subclass Vs Concrete Class fs

    Hi,

    U mean to say Concrete classes are instantiatable
    and every concrete class is a subclass of some
    super class.Plz clarify me if i am wrong.That's correct. But it's also true that every class--both concrete and abstract--is a subclass of some superclass, except Object which has no superclass.

    NOTE: The following is simply provided in the interest of completeness because I'm a ballsniffing pedant. It's not that important to what you're asking about, and may just cause more confusion. Feel free to ignore it.

    Also, it's possible to make a concrete class non-instantiable by having a single private constructor and throwing an exception from it, but that's a runtime issue--the compiler will let you insstantiate the class (only from within itself if the c'tor is private).

  • RELEVANCY SCORE 4.35

    DB:4.35:Difference Between The Interface And Abstarct Class ss


    HI all,I have a doubt over Difference between the Interface and Abstarct classi.e interface came into play for these reasons1. pure abstartc class (this can be done using abstartc class tooo)2. multiple inheritanceif i declare a abstartc class with only abstract methods does that ressembles interface i mean them interface adn abstartc class are same ? (except inheritance case)or is any difference in case of memmory allocation etc.,Regards

    Manoj Mathe

    DB:4.35:Difference Between The Interface And Abstarct Class ss

    In interface, you can only have Public access modifier.In abstract class, all acces modifiers are allowed.For example, if you need to declare abstract methods that are internal, private, etc... and that there is no multi inheritance,you need an abstract class.There are other differences.Check this :http://www.codeproject.com/KB/cs/abstractsvsinterfaces.aspxIn terms of memory allocation, I would say it's the same, both are Reference Types, and are so managed in the same way.Hope this helps,Tom

    Thomas Aimonetti - C# - Sharplog Engineering

  • RELEVANCY SCORE 4.35

    DB:4.35:Inherit Abstract Classe fc


    Can anyone show me how to make a class inherit all functionalitied from two difference abstract classes in my progam. thanks

    Jadebui.

    class a extends b ??????????
    {}

    abstract class b
    {}

    abstract class c
    {}

    DB:4.35:Inherit Abstract Classe fc

    if you want to declare both classes(b and c) as abstract you can not do multiple inheritances, try this way

    class a extends b{

    }

    abstract class b extends c{

    }

    abstract class c{

    }or you have to decide to declare one of the abstract classes as an interface

  • RELEVANCY SCORE 4.33

    DB:4.33:Difference Between Abstract Class And Interface ca


    Hi everyone,

    CAn anyone explain why the following happen????

    --------------------------------------------------------------------------------
    Abstract class can have a constructor, Interface cannot.
    Abstract class can have static methods, Interface cannot.
    --------------------------------------------------------------------------------

  • RELEVANCY SCORE 4.30

    DB:4.30:Abstract Class And Interface 97


    is it any differences between abstract class and interface?

    DB:4.30:Abstract Class And Interface 97

    And of course you [url http://onesearch.sun.com/search/developers/index.jsp?col=devforumsqp_name=Java+Programmingqp=forum%3A31qt=%22+differences+between+abstract+class+and+interface%22] searched first....

    Mike

  • RELEVANCY SCORE 4.30

    DB:4.30:Abstract Class Vs Interface sc


    can anyone pls help me in understanding difference between an interface and an abstract class which has no function with implementation

    which is better abstract cls or interface in term of speed, features..?
    Thanksbahushekh

    DB:4.30:Abstract Class Vs Interface sc

    To Mike Feng or any other moderator,
    Can you unmark
    as answer the previous post from myself please?
    Reason: It has no relevance to the original question, I was just replying to the post preceding it from RudeDog2
    which I also feel, does not really relate to the original question.
    I will leave it to Rudy to decide if He wants that post to be unmarked.

    Regards,

    John

    Click this link to see how to insert a picture into a forum post.

  • RELEVANCY SCORE 4.30

    DB:4.30:Using An Abstract Class : Bytebuffer 7m


    In Java.nio.* there is a class called ByteBuffer

    According to the documentation this is an abstract class.

    From what I read in the tutorials this means that it can't be instantiated. Further, it means that the methods declared as ABSTRACT are just declarations and not implemented...

    And yet in one of the examples I found that class in use!
    So I tried it... and it works just fine. Not only can a make a ByteBuffer object, I can call on the abstract functions and they work as expected.

    I can do this


    byte[] myBytes = new byte[100]
    ByteBuffer myBuffer = ByteBuffer.wrap(myBytes);
    short myShort = 0x0102;
    myBuffer.putShort(myShort);
    myBuffer.order(LITTLE_ENDIAN);
    myBuffer.putShort(myShort);

    for (i = 0; i4; i++){
    system.out.println(myBytes);
    }
    This will give output like
    01
    02
    02
    01

    Which is just what I would expect of the order method, and the putShort method worked and were _not_ abstract.
    So these methods like putShort which are declared as abstract are actually implemented.
    And I can make a ByteBuffer object such as myBuffer provided I use the static "wrap" function.

    What I can't do is the following...ByteBuffer newBuffer = new ByteBuffer(sizeOfBuffer);
    That will yield an error claiming that it is not possible to instantiate an abstract class.

    Okay but other than I don't have a normal constructor, what is the meaning of declaring a class abstract? The object called myBuffer seems to have all the properties of an instatiated object that I can tell except that maybe its underlying class, myBytes, is exposed. But the same would be true of DataBuffer and BufferedInputStream objects (whose underlying steams are passed in the constructor but are still exposed) and they are not declared abstract.

    And what about the methods that are abstract? What is the difference between those an a normal method?

    P.S. That is just pseudo code up there... I haven't tested it to compile or anything... it is just to give you an idea.

    Edited by: piMeson on Feb 2, 2010 10:32 AM

    DB:4.30:Using An Abstract Class : Bytebuffer 7m

    Google the Factory pattern. Quite common. Most of NIO exhibits it in spades, for example Selector.open(), SocketChannel.open(), ByteBuffer.create()/wrap()/...

  • RELEVANCY SCORE 4.30

    DB:4.30:Java Language Basic Question? 8x


    1.Abstract class AbstractXMLReader implements interface XMLReader.
    2.Class SQLXMLReader extends AbstractXMLReader.
    Who can tell me what difference between the following code section?
    case 1: public class SQLXMLReader extends AbstractXMLReader implements XMLReader {}
    case 2: public class SQLXMLReader extends AbstractXMLReader {}
    Are they same?
    Many thanks
    Colin

    DB:4.30:Java Language Basic Question? 8x

    Sorry,
    i didn't try it.
    I've just try it, and Jesper is right.

    Maybe that could be useful with javaDoc (but i didn't try it).

  • RELEVANCY SCORE 4.30

    DB:4.30:Abstract Class And Interface Use 1k


    hi

    i am asking some stupied questions. plz can any one tell me

    1) what is interface and abstract class ? one example?
    2) when do u go for interface and when do u go for abstract class?
    3) what is exact difference between abstraction and encapsulation?

    thanks in advance

    DB:4.30:Abstract Class And Interface Use 1k

    Mahaboob wrote:
    hi

    i am asking some stupied questions.I agree.

    plz can any one tell meHere's a much better idea. You go do some basic research on these questions which have been asked 1,000,000,000 times previously and then tell us what you think. Then we can have a lively discussion about your ideas.

    'kay?

    And just to get you started in the right direction here's something you can review that will answer part of or all of your questions [_http://java.sun.com/docs/books/tutorial/java/index.html_|http://java.sun.com/docs/books/tutorial/java/index.html]

  • RELEVANCY SCORE 4.24

    DB:4.24:Difference Between Interface And Abstract Class? x1


    Hi,

    Can u plz explain
    at what scenarios we use interface and abstract class.?

    Thanks,
    B.Maruthi

    DB:4.24:Difference Between Interface And Abstract Class? x1

    If you had read the FAQ at the top of the forum home
    page you wouldn'y have bothered to ask this
    question.Anyways heres the link

    Read the question number 13 in this link

    http://access1.sun.com/FAQSets/newtojavatechfaq.htmlnice

  • RELEVANCY SCORE 4.24

    DB:4.24:Diff. Between Interface And Abstract Class 3s


    hi,
    Can any one tell me about diff between interface and abstract class in practical way.advanced thanks for ur response.
    -PVMVS

    DB:4.24:Diff. Between Interface And Abstract Class 3s

    This question gets asked all the time. I found lots of hits by searching this forum with the words: interface abstract class difference

    I'm sure google will return even more. Searching existing posts should always be done before posting.

  • RELEVANCY SCORE 4.22

    DB:4.22:Difference j9


    difference between abstract class and interface

    DB:4.22:Difference j9

    @OP You can see by the blatant obviousness and boring repetitiveness of these answers that this is a frequently asked question.

  • RELEVANCY SCORE 4.15

    DB:4.15:What Is Difference Between Abstraction And Abstract Class ? j3


    What is difference between abstraction and abstract class ?

  • RELEVANCY SCORE 4.11

    DB:4.11:Re: What Is The Difference Between An Interface And An Abstract Class? 1a


    8000 views already wow.

    DB:4.11:Re: What Is The Difference Between An Interface And An Abstract Class? 1a

    filestream wrote:
    As the two famous politicians, Jonathan Curry and Larry Craig are wont to say, "Glad I could serve you."

    Of course, each says it in entirely different situations but we're not here to discuss that. The members of the forums are happy just knowing that we've cleared 1 doubt.Now that you mention it, I take a wide stance in the interface/abstract class issue.

  • RELEVANCY SCORE 4.11

    DB:4.11:Need Help With Abstract Method ? 7p


    **************************************************
    public abstract void sleep()
    {
    ..........
    }
    **************************************************
    Could someone please tell me what is the difference of an abstract method in comparing to an instance or a class method? How should I do the invocation to an abstract method by other methods of its own class and of another class? Must I define abstract methods within abstract classes? Do I need to redefine abstract methods before using them? Thanx!

  • RELEVANCY SCORE 4.10

    DB:4.10:Abstract Classes And Interfaces kp


    I am kinda new to Java but have been studying frequently. I have a question that is probably very simple: What is the difference/advantage between an abstract Class and an Interface?

    DB:4.10:Abstract Classes And Interfaces kp

    Search the forum. Here's a topic that addresses it:
    http://forum.java.sun.com/thread.jsp?forum=31thread=273324

  • RELEVANCY SCORE 4.09

    DB:4.09:Regarding The Abstract And Interface km


    hai,
    I am new to java programming

    I want to difference between abstract interface,interface and abstract class

    public abstract interface Test{}

    public interface Test{}

    public abstract class Test{}

    which kind of situations use the above interfaces and abstract classes

    It would be helpfull if explain with example....

    Thanks

    DB:4.09:Regarding The Abstract And Interface km

    shashikumar, please don't multipost and don't use the browser's back button to edit your post. This creates multiple posts. I've removed the other thread you started a minute after this one.

    db

  • RELEVANCY SCORE 4.09

    DB:4.09:Difference Between Singleton Class&Amp; Static Class kz


    What is the difference between Singleton Class Static Class

    DB:4.09:Difference Between Singleton Class&Amp; Static Class kz

    A singleton class is a class from which only one and the same instance can be obtained. This instance can have non-static variables and methods. A static class is like an utility class with only static variables and methods.

    The use of singletons is discouraged, because this almost always indicates a design flaw in the application.

  • RELEVANCY SCORE 4.06

    DB:4.06:Difference Between Interface And Abstract Class mj


    hello friends give me the difference between interface and abstract class
    and link to find java material

    Thanx

  • RELEVANCY SCORE 4.05

    DB:4.05:Abstract Class And Interfaces xz


    Hi Recently

    I attended a Interview ,Interviewer asked me what is difference b/w abstract and interface.

    I cud give answer ,,he said what if abstract class has all abstract methods.in this situation is ther any difference between abstract class and interface..

    i said there will be no difference in making all methods abstract and it is similar to interface.the only difference is at one point of time u can have a class can inherit only one abstarct class whereas interface u can have more than one interface....

    I want to know is my answer is right r not..please suggest is it correct and if any other ans please do reply

    With Regards
    Mahender
    Mahender

    DB:4.05:Abstract Class And Interfaces xz

    Stepping away from purely technical differences, there are some more fundamental ones.First there is a semantic difference. A base class says that any derived classes have an is a relationship with the base. For example you could have a base class such as Stream because derived classes are streams, but you wouldn't have a base class such as Serializable because you couldn't say that a derived type is a Serializable.Secondly there is the versioning problem. With an abstract base class you can add non-abstract members in future versions without breaking any existing functionality (save for possibly name collisions) because the base class provides the implementation. With an interface you can never add members because you will break any existing implementors. http://gregbeech.com/blogs/tech

  • RELEVANCY SCORE 3.99

    DB:3.99:Difference Between Abstract Class And Interface ? fz


    CAN ANY BODY TELL ME THE DIFFERENCE BETWEEN THE ABSTRACT CLASS AND INTERFACE ?

    DB:3.99:Difference Between Abstract Class And Interface ? fz

    - An abstract class is a class that can not be instantiated but that can contain code, i.e. it gives you the ability to specify default implementations of methods.

    - An interface only contains methods but does not contain any code and you need to implement all the methods defined in the interface.
    - Interfaces may be multiple-inherited, abstract classes may not
    http://www.codeproject.com/Articles/11155/Abstract-Class-versus-Interface
    http://stackoverflow.com/questions/56867/interface-vs-base-class

  • RELEVANCY SCORE 3.94

    DB:3.94:A C Sharp Basic Question! s9


     
    I wonder the difference between the abstract class and the interface!
    Someone help me!

    DB:3.94:A C Sharp Basic Question! s9

     xiaobin700 wrote:

     
    Thanks
    Can a method in an abstract  class be overload? And how about an interface?

  • RELEVANCY SCORE 3.92

    DB:3.92:Difference Between An Interface And An Abstract Class 9f


    Hey:

    I'm curious, what's the difference between an interface and an abstract class? Thanks.

    DB:3.92:Difference Between An Interface And An Abstract Class 9f

    "You have an abstract class if you want to implement some of the methods in it, but you do not want users to make instances of the class or do not want to implement all of the methods. Take a look at some of the abstract classes in java.util. Nearly all of the methods are implemented already so that it's far easier to create new data structures than if only interfaces were provided. "

    That's what I was looking for. Thanks.

  • RELEVANCY SCORE 3.90

    DB:3.90:Difference Between Abstract Class And Interface 71


    Here is a fresher in Java. Could any body tell me the difference between Abstract Class and Interface. And suppose Abstract class has three methods, in those, two of them are Abstract and one is normal method, and it has been implemented in that class itself. If we extend the Abstract class to our class, do we need to over ride or implement all the methods that are there in the Abstract class or we need to implement only those methods that have been declared as abstract. If it is so, then what is the purpose of implementing non abstract method in the Abstract class.

    Sravan

    DB:3.90:Difference Between Abstract Class And Interface 71

    public abstract class TestAbstract {
    public abstract void method1();
    public abstract void method2();
    public static void method3() {
    // non-abstract method must have a body
    }
    }

    public class TestAbstract2 extends TestAbstract {
    public void method1() {
    // Does not work:
    // Object test = new TestAbstract();
    TestAbstract.method3();
    }
    public void method2() {
    }
    }- you will have to implement all method which are declared as abstract. you do not need to implement method3 in this example., only method1 and method2.
    - an abstract class cannot be instantiated (doesn't work: Object test=new MyAbstractClass())
    - a non-abstract method in an abstract class can be used, if it's a static member.
    - with "extends" you can only have one class, and your class will inherit the members of the superclass
    - with "implements" you can use multiple interfaces, which are only a description of what you have to write yourself...

  • RELEVANCY SCORE 3.90

    DB:3.90:Assigning Object To Interface Type And Abstract Class Type. pm


    Can any one please tell me what is the difference between assigning the object to Interface type and abstractclass type instead of assigning to class type except that, if we assign an object to interface or abstractclass type, then we can access only the methods available in interface or abstract class.
    Code:
    Class cls = new Class();

    // Need Difference between the following

    Interface inf = new Class();
    AbstractClass abscls = new Class();Thankyou,
    Ram

    DB:3.90:Assigning Object To Interface Type And Abstract Class Type. pm

    Note: This thread was originally posted in the [Reflections Reference Objects|http://forums.sun.com/forum.jspa?forumID=4] forum, but moved to this forum for closer topic alignment.

  • RELEVANCY SCORE 3.90

    DB:3.90:Best Situation That Describe Difference Between Interface And Abstract c7


    Hi, Please tell me the best example or situation where we should choose interface or abstract class?

    DB:3.90:Best Situation That Describe Difference Between Interface And Abstract c7

    Smiley,
    It is the same as about apples and computers.
    An Interface is a contract, it describes what a class should contain to implement it (and can than be used to to get those members of a class whichfulfillthe contract) but an interface contains no actual implementation.
    An Abstract Class is a class itself which can be (only) inherited used as base for another class, the members and properties of a base class can be used likewise the inheriting class.
    Because of above can an Abstract Class implement an Interface, however an Interface cannot implement an Abstract class.

    Success
    Cor

  • RELEVANCY SCORE 3.85

    DB:3.85:What Is The Difference Between Abstract And Interface? zd


    Could some one explain what is the difference between abstract class and interface class.

    Lets say I'm creating class why would I choose abstract over interface?

    THanks.

    DB:3.85:What Is The Difference Between Abstract And Interface? zd

    The difference between abstract classes and interfaces is interfaces are defined methods only. In abstract class methods are derived.

  • RELEVANCY SCORE 3.82

    DB:3.82:Re: Abstract Class Vs Interface Difference jc


    While this is by no means complete, the major
    differences between an interface and an abstract
    class with all abstract methods is that you don't
    have to create an implementation for the abstract
    methods in a class that extends the abstract class.Yes you do; unless the extending class is also abstract.

    You do have to implement all methods in an
    n interface. Also you can use access modifiers other
    than public in an abstract class, while interface
    methods must always be public. public or package-private?

    If you don't know why either of these things would be useful then you
    probably don't care, and could just use an interface.And seeings as people are answering here desipte the laziness; abstract classes can also have implemented methods, and member variables. Interfaces cannot.

    DB:3.82:Re: Abstract Class Vs Interface Difference jc

    While this is by no means complete, the major
    differences between an interface and an abstract
    class with all abstract methods is that you don't
    have to create an implementation for the abstract
    methods in a class that extends the abstract class.
    You do have to implement all methods in an
    n interface. No.

    The rules for what must be implemented are the same regardless of whether it's a class or an interface.

  • RELEVANCY SCORE 3.81

    DB:3.81:Whats The Difference Between These Types Of Classes? k8


    What's the difference between using a "private inner class", an "anonymous inner class", and a "class that implements on itself" to create a GUI?

    Also, what's the difference between regular classes, abstract classes, and interfaces?

    I ask because I'm an excellent coder, but have trouble understanding the terminology behind the code and also explaining the code.

    DB:3.81:Whats The Difference Between These Types Of Classes? k8

    You going to hand out the dukes if I bother to type a long-winded explanation? :)

  • RELEVANCY SCORE 3.81

    DB:3.81:Abstract Class And Interface???? 39


    hi all, i would like to know the difference between abstract class and interface....could anybody enlighten me on this....

    DB:3.81:Abstract Class And Interface???? 39

    P.S. don't be a loser an put up multiple posts, especially on something so easy to do a search on.

  • RELEVANCY SCORE 3.78

    DB:3.78:Java Interfaces And Abstract Classed fc


    what is the difference between interface and abstract class?

    DB:3.78:Java Interfaces And Abstract Classed fc

    I suggest you try writing some code and see.

  • RELEVANCY SCORE 3.78

    DB:3.78:Interfaces Vs. Abstract Classes ps


    1) is there a difference between an interface (that has methods to override) and an abstract class?

    2) also what is the purpose of static members, static methods, and static classes??

    3) is there a distinction between an Abstract Data Type and User Defined Data Types?

    DB:3.78:Interfaces Vs. Abstract Classes ps

    Read Core Java Fundamentals Volume 1 by Horstmann Cornell from Sun Micro. Press release.
    Its a must to know them very well from reading it from the above book rather than relying on what you hav learnt from a discussion board. by the way, its just a personal statement, not intended to offend any fellowmates of the discussion board.

    cheers

    -tamoghna

  • RELEVANCY SCORE 3.77

    DB:3.77:Purpose/Advantage Of Abstract Class sk



    Hi,

    I'm aware of the functionality of the Abstract class.

    But what is the purpose or advantage of using it. Where ever we are using an Abstract class, we can replace it with a normal class achieve the same functionality. Is there any scenario like only Abstract class can be used?

    Thanks Regards,

    Adithya M.

    DB:3.77:Purpose/Advantage Of Abstract Class sk


    Hi,

    Abstract class generally used to design prototype of a system. So system can be simpler in terms of development.

    Regards,

    Pradip Patel

  • RELEVANCY SCORE 3.77

    DB:3.77:Abstract Class 8s


    What does it mean to declare a class as abstract?

    DB:3.77:Abstract Class 8s

    If you have at least one abstract method in your
    class, that class must be abstract.

    If you implement any interface and you dont override
    all methods of that interface, your class must be
    declared abstract.

    If you extend an abstract class and you dont override
    all abstract methods of the parent class, your class
    must be declared abstract.

    Abstract generally is used to create an specific
    behavior available to all subclasses. And each
    subclass must override that abstract method in such a
    specific behavior.

    I think thats it.There's one more situation. It's when you declare a fully concrete class to be abstract. It's useful when you want a class to act as superclass but you want to supply a default implementation to all methods. Subclasses only have to override what they want to change.

  • RELEVANCY SCORE 3.77

    DB:3.77:Help Pls! 87


    Hi, can someone pls tell me what the difference between a normal class and an 'abstract class' is.

    Thanx!

    DB:3.77:Help Pls! 87

    Chris Evans just rang to call it off, apparentley he'd rather be seen with someone cool like Danny Baker and that my wife was too old for him.
    So I'll knock up a quick batch of proper nosh and meet yer all there. Hope you all like Pie and Mash Suchi, beautiful.

    Jamie

  • RELEVANCY SCORE 3.77

    DB:3.77:Who Can Tell The Difference Of The Abstract Interface Class? 79


    someone ask me that he had a abstarct interface class, such as :
    public abstract interface Book{
    }
    I was comfused, who can tell me why use it?

    DB:3.77:Who Can Tell The Difference Of The Abstract Interface Class? 79

    http://java.sun.com/docs/books/tutorial/java/interpack/interfaceDef.html

    Scroll down to the bottom.

    Drake

  • RELEVANCY SCORE 3.77

    DB:3.77:Abstract Class km


    when to use an abstract class

    DB:3.77:Abstract Class km

    how to model?You want to model?

    That's news! But welcome?

  • RELEVANCY SCORE 3.74

    DB:3.74:Interface And Abstract Class Difference 18


    An interface can be used in such a way that we don't know the class of object assigned to a reference of that interface type until runtime. Can we use the abstract class in a similar way too?

    The difference between an abstract class and interface can be listed as
    1. Interface can not have implementation of any method
    2. The usage of interface and class is one other difference
    3. What other differences we have?

    DB:3.74:Interface And Abstract Class Difference 18

    941767 wrote:
    Here we have some more difference...Differences that mean nothing to an experience professional programmer.

  • RELEVANCY SCORE 3.73

    DB:3.73:Difference Between Abstract Class And The Normal Class 7k


    Hi...........

    can anyone tell me use of abstract class instead of normal class

    The main doubt for me is...
    1.why we are defining the abstract method in a abstract class and then implementing that in to the normal class.instead of that we can straight way create and implement the method in normal class right...../

    DB:3.73:Difference Between Abstract Class And The Normal Class 7k

    Class vs. interface
    Some say you should define all classes in terms of interfaces, but I think recommendation seems a bit extreme. I use interfaces when I see that something in my design will change frequently.

    For example, the Strategy pattern lets you swap new algorithms and processes into your program without altering the objects that use them. A media player might know how to play CDs, MP3s, and wav files. Of course, you don't want to hardcode those playback algorithms into the player; that will make it difficult to add a new format like AVI. Furthermore, your code will be littered with useless case statements. And to add insult to injury, you will need to update those case statements each time you add a new algorithm. All in all, this is not a very object-oriented way to program.

    With the Strategy pattern, you can simply encapsulate the algorithm behind an object. If you do that, you can provide new media plug-ins at any time. Let's call the plug-in class MediaStrategy. That object would have one method: playStream(Stream s). So to add a new algorithm, we simply extend our algorithm class. Now, when the program encounters the new media type, it simply delegates the playing of the stream to our media strategy. Of course, you'll need some plumbing to properly instantiate the algorithm strategies you will need.

    This is an excellent place to use an interface. We've used the Strategy pattern, which clearly indicates a place in the design that will change. Thus, you should define the strategy as an interface. You should generally favor interfaces over inheritance when you want an object to have a certain type; in this case, MediaStrategy. Relying on inheritance for type identity is dangerous; it locks you into a particular inheritance hierarchy. Java doesn't allow multiple inheritance, so you can't extend something that gives you a useful implementation or more type identity.

    Interface vs. abstract class
    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.

  • RELEVANCY SCORE 3.73

    DB:3.73:Who Can Tell The Difference Of The Abstract Interface Class? xf


    someone ask me that he had a abstarct interface class, such as :
    public abstract interface Book{
    }
    I was comfused, who can tell me why use it?

    DB:3.73:Who Can Tell The Difference Of The Abstract Interface Class? xf

    Cross post - http://forum.java.sun.com/thread.jspa?threadID=694601tstart=0

  • RELEVANCY SCORE 3.73

    DB:3.73:Interface And Abstract Class dd


    what is the difference between interface and Abstract class?
    What are the situations we have to go for interface and Abstract class?

    DB:3.73:Interface And Abstract Class dd

    Neither an abstract class nor an interface can be instantiated (meaning you cannot create the object directly with the "new" keyword). They are both similar in that they have abstract methods. (Technically, you can create an abstract class with no abstract methods, but I would question the utility of making that class abstract in the first place).

    The two main differences are the following:

    Implementation: An abstract class can implement methods, since it is a class. An interface can never implement any methods, it only declares their signatures.Inheritance: A given class can implement an unlimited number of interfaces. A class can only extend one class. In general, I use the following rules of thumb when deciding (other developers may have differing opinions):

    Given the choice, use an interface. Since you can implement an unlimited number of interfaces, they are not as restricted, from a class hierarchy perspective. If you have several classes with the same instance (class) variables declared and several methods that all accomlplish the same thing (normally, they will even have segments of code copy-pasted between classes), then re-factor the common variables and code into an abstract class. When using interfaces, always consider delegation. Delegation is something like the following:interface IFoo {
    abstract public void bar();
    }

    public class FooDelegate {
    final public void bar() {
    // Default implementation goes here
    }
    }

    public class FooImpl implements IFoo {

    final public void bar() {
    new FooDelegate().bar();
    }
    }

    The advantage of delegation is that you can write a "helper" that contains the implementation, and then the classes that actually implement the interface can simply use the helper (e.g., delegate the implementation to another class).

    - Saish

    "My karma ran over your dogma." - Anon

  • RELEVANCY SCORE 3.72

    DB:3.72:Abstract Class sc


    What is the use of Abstract class with no abstract methods? Please let me a scnerio where this is used instead of a Normal class

    DB:3.72:Abstract Class sc

    There really isn't much point in such a class at all. But let me turn the question around: what would be the point of requiring an abstract class to have at least one abstract method?

  • RELEVANCY SCORE 3.69

    DB:3.69:Java Programming 33


    what is the difference between 'abstract' class and 'interface'

    DB:3.69:Java Programming 33

    Hey, get back in line. Don't jump the queue :)Well I guess I haven't qualified myself for this
    year's hunt. Maybe I could get a free-card because I
    was always on the Most Arrogant List a few years ago.Ok. I'll be nice. You'll get a free pass.

    Kaj

  • RELEVANCY SCORE 3.67

    DB:3.67:Interface And Abstract Class c8


    Hi,

    Could you please let me know what is the exact difference between interface and abstract class.Which one is better to use .Could you please give me indepth answer.

    DB:3.67:Interface And Abstract Class c8

    Stop. Stop. Stop. I beg you...You're behaving like a Chinese gentleman with sand in his boots. Stop.

    Do we save the execution time by using interface.This is a compiler/byte code related question. Please post it in the proper place.

    What might be the behaviour inside the memory
    location by using interface and abstract class.Same answer.

    /Morten

  • RELEVANCY SCORE 3.67

    DB:3.67:Difference Between Abstract Classes Vs Interface 77


    Hi,
    Can u pls mention all the differences between Abstract Classes and Interface.? I've mentioned the differences I've known here.

    Known Differences:
    ------------------
    (*) An interface cannot implement any methods, whereas an abstract class can.
    (*) A class can implement many interfaces but can have only one superclass

    Can U pls mention at what situation(practical situation) we've to go for abstract class or Interface?
    Tell me the situation when we have to go for abstract class?
    Tell me the situation when we have to go for interface?

    Please Reply me
    Thanks Regards
    Venkatesh

  • RELEVANCY SCORE 3.63

    DB:3.63:Difference Between Abstract Class And Interfaces 9a


    Hi,

    Any body can tell me In which scenarios we use abstract class and in which scenario we use interfaces.

    In real time applications.

    DB:3.63:Difference Between Abstract Class And Interfaces 9a

    [url http://www.javaworld.com/javaworld/jw-09-2001/jw-0921-interface.html] maximizing flexibility

  • RELEVANCY SCORE 3.62

    DB:3.62:Abstract Class zx


    Hi,
    When to prefer abstract class without any method as abstract?

    Regards
    SamyMohan

    DB:3.62:Abstract Class zx

    wait grr.. I think I got it backward :-p.
    You need to implement abstract methods, and you do not need to implement non-abstract methods (but you can).
    ~sorry, I just woke up

  • RELEVANCY SCORE 3.61

    DB:3.61:Diff Interface And Abstract Class af


    I would like to know difference between Interface and abstract class.

    I know simple differences ... like with iterface u can achieve multiple inheritence and with abstract class can have method definition.

    It is said that with interface u achive less coupling, while its other way with abstract class.

    What exactly does this mean ?? how this is implemented programatically ??

    Cheers,
    Rana

    DB:3.61:Diff Interface And Abstract Class af

    You're not saying this is a reason not to use interfaces, are
    you?I haven't (yet) had this situation happen to me as a result of evolution of my APIs but I would think that's one thing to consider when choosing whether you should go with an abstract class or an interface for a supertype.

  • RELEVANCY SCORE 3.61

    DB:3.61:Abstract Class And Interfaces s7


    I'm learning java on my own right now, but I still don't understand interfaces and abstract methods.What's the difference between an abstract class and interfaces? Why are interfaces important? Why can you not just create your own methods?

    Thanks

    DB:3.61:Abstract Class And Interfaces s7

    This question is asked and answered very often in this forum. Do a search.

  • RELEVANCY SCORE 3.60

    DB:3.60:Concept Of Abstract Class &Amp; Interface fc


    Hi friends,

    My question is what is the main difference between Abstract class Interface?

  • RELEVANCY SCORE 3.59

    DB:3.59:Difference B/W Abstract Class And Interface dx


    hi friends,

    can anyone plz divulge the differences between abstract class and interface and under what situations can we use these concepts.

    thanks

    madhusudan.D

  • RELEVANCY SCORE 3.58

    DB:3.58:Abstract/Virtual Events a3


    If you have an abstract base class which has an event that children may
    implement, and none of the base class methods connect or raise the
    event, then what's the difference between declaring that event as
    either abstract or virtual?  I can't find much of anything in the
    docs about abstract or virtual events.  

    DB:3.58:Abstract/Virtual Events a3

    IIRC (and bear with me, since I'm not near any docs), an event is effectively a field of type delegate, along with three hidden methods: raise, add and remove. Fields cannot be virtual, so one would assume that the virtual refers to the methods associated with the field.
    The base implementation of add, simply adds the delegate to the InvocationList of the delegate field, the remove reverses this operation, and the raise invokes the delegate.
    When you say MyEvent(this, EventArgs.Empty) for example, you are effectively calling the raise method. Now the interesting thing is that AFAIK you cannot override the add, remove raise methods. I can't remember why, but I'm fairly confident I'm right on this one. This sorta makes the virtual superfluous.
    If you want child classes to fire the event, the pattern is to provide a protected virtual OnEventName method which fires the method. This allows the child class to stop the event being fired if neccessary, and also to invoke it itself:
    class Parent {

    public event EventHandler MyEvent;
    protected virtual OnMyEvent() {

    if(MyEvent != null) {

    MyEvent(this, EventArgs.Empty);
    }
    }
    }
    class Child : Parent {

    public void MyMethod() {

    // Some code
    OnMyEvent(); // Fire MyEvent
    }
    // Optional, if you want to do stuff even if the event handler is not hooked up, or
    // want to modify when MyEvent is fired:
    protected void override OnMyEvent() {

    base.OnMyEvent(); // Fire MyEvent, if you want to.
    // Do some stuff.

    }

  • RELEVANCY SCORE 3.58

    DB:3.58:Good Simple Example Of Difference Between Interface And Abstract Class 83


    Hi All,

    I am new to java...

    I am confused lot about the difference between interface and abstract class....

    Can anybody tell me the difference between interface and abstract class with some good and simple exmple...

    Kindly help me...

    Thanks in advance...

    DB:3.58:Good Simple Example Of Difference Between Interface And Abstract Class 83

    phdk wrote:
    georgemc wrote:
    public class AbstractClassThatIsntAnInterface {

    public abstract void doSomething();
    public abstract void doSomethingElse();

    }Nice naming for a nonabstract class! ;-)

    @OP: read this: [http://java.sun.com/docs/books/tutorial/java/IandI/abstract.html]Er, you, um, spotted my deliberate mistake.....

  • RELEVANCY SCORE 3.57

    DB:3.57:Interfaces And Abstract Classes fk


    hi,

    Can anyone help me regarding the difference between interfaces and abstract classes. What is the advantage of interface over abstract classes and viceversa. Obout the possibities of multple inheritance I know. I found allmost all people are talking some external answers.
    Why an abstract class cant we do it with concrete class.
    regards,

    Jayaprasad Viswanathan

    DB:3.57:Interfaces And Abstract Classes fk

    Abstarct class can never be instantiated. Same as interfaces.

    Can be
    subclassed.Same as interfaces.

  • RELEVANCY SCORE 3.57

    DB:3.57:Difference Between The Usebean Class And Normal Java Class jj


    Hi all,

    What is the difference between the useBean class and normal java class

    By Jino Augustine

    DB:3.57:Difference Between The Usebean Class And Normal Java Class jj

    http://forum.java.sun.com/thread.jspa?threadID=500144messageID=2363524

  • RELEVANCY SCORE 3.56

    DB:3.56:What Is The Difference B/W Abstract Class And Interface j9


    Hi everybody!
    I'm little confused abt the difference b/w abstract class and interface. Plz help me in this regard.
    Bye
    Mustafa

    DB:3.56:What Is The Difference B/W Abstract Class And Interface j9

    You've got a lot of postings describing the semantic differences, here's one that gives you a practical difference: use interfaces to define policy, abstract classes to define mechanism.

    Assuming that got a big "huh?" ...

    An interface defines a set of methods, which I think of as "capabilities." For example, java.util.List defines methods to add/remove/retrieve items to a list. Any object that implements that interface is saying that it has the capability to maintain items in a list. However, it doesn't say anything about how that object is implemented; perhaps it uses an array, perhaps a linked list.

    By comparison, java.util.AbstractList defines at least part of the mechanism used to implement the List interface. It still leaves some of the implementation open to the programmer, but handles a lot of the details common to all lists.

    By keeping this practical definition in mind, I'm not tempted to use an abstract class in place of an interface. Instead, I limit abstract classes to places where there's common implementation -- in other words, they become a refactoring tool.

    One example: as I've started to develop Swing apps, I find that I'm implementing a lot of dialogs. Since I want a common look and feel to my dialogs, there's a lot of code that's common. However, since each dialog has a separate purpose in life, there's also a lot that differs. So I implemented an AbstractDialog class that handles common operations such as UI decorations.

    Now, I could have implemented this as an instantiable class, which would have methods that are overridden by subclasses. But I went with an abstract class for two reasons: (1) there's no reason to instantiate the base dialog, and more important, (2) by defining certain methods as abstract, I force the subclass into providing implementations, thus eliminating bugs due to laziness.

    One last comment: this example defines very little in the way of policy, so it's clearly a candidate to be an abstract class. You may wonder what to do about objects that aren't so clear, but I've found that there are very few of these. In my version of a good OO design, objects either define policy or mechanism, but almost never both.

  • RELEVANCY SCORE 3.56

    DB:3.56:What Is The Main Difference Between Interface And Abstract Class 37


    Hi ,

    Please help on this ..

    Regards,
    vij

    DB:3.56:What Is The Main Difference Between Interface And Abstract Class 37

    All the methods declared inside interface should be abstract

    All the methods declared for an interface are abstract, by definition.

    but in case of abstract class at least one method should be abstract

    No. An abstract class is not required to have any abstract methods. It's not even a "should".

    Abstract class must be extended abstract ()
    methods generally contain only declaration part
    without definition part.
    No "generally" about it, as there are no exceptions. Abstract methods do not have a declared body, by definition.

    ~

  • RELEVANCY SCORE 3.55

    DB:3.55:Interface And Abstract Class ac


    hi all,

    A method in an interface consists of access specifiers as public or abstract. what is the difference if the access specifiers for the method is public and abstract.

    regards,
    priya

    DB:3.55:Interface And Abstract Class ac

    That is correct. They must be because interface methods must be overridden when subclassed.

  • RELEVANCY SCORE 3.55

    DB:3.55:Normal Class Vs Abstract Class kj


    Hi I have a question, When should we use abstract class,Normal methods with virtual methods also provide similar functionality, Only
    difference is we cannot instantiate abstract class.What are differences between normal class and abstract class.

    Regards,
    Shijith

    DB:3.55:Normal Class Vs Abstract Class kj

    Hello Shijith,
    Just for the title, I would recommend you read this thread:
    http://social.msdn.microsoft.com/Forums/vstudio/en-US/71e0e521-b742-48ee-a8a8-c7fdda8a2bc4/why-do-we-need-to-use-abstract-classes-interfaces-?forum=csharpgeneral
    Why abstract is used:
    An abstract class is a special kind of class that cannot be instantiated. So the question is why we need a
    class that cannot be instantiated? An abstract class is only to be sub-classed (inherited from). In other words, it only allows other
    classes to inherit from it but cannot be instantiated. The advantage is that it enforces certain hierarchies for all the subclasses.
    In simple words, it is a kind of contract that forces all the subclasses to carry on the same hierarchies or standards.
    Then please read this:
    http://stackoverflow.com/questions/391483/what-is-the-difference-between-an-abstract-function-and-a-virtual-function

    An abstract function can have no functionality. You're basically saying, any
    child class MUST give their own version of this method, however it's too general
    to even try to implement in the parent class. A virtual function, is basically
    saying look, here's the functionality that may or may not be good enough for the
    child class. So if it is good enough, use this method, if not, then override me,
    and provide your own functionality.

    I do think their explanation is good enough for your issue.
    Regards,
    Barry Wang
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.

    Click
    HERE to participate the survey.

  • RELEVANCY SCORE 3.54

    DB:3.54:Difference Between Pure Abstract Class And Interface? 89


    hi,
    i just want to know the difference between pure abstract class(as same as interface- no implementation of methods) and interface

    Thanks,

    DB:3.54:Difference Between Pure Abstract Class And Interface? 89

    A very nice and detailed article on this code project link (posted by Magnus).

  • RELEVANCY SCORE 3.53

    DB:3.53:Can Any One Give The Difference j1


    can any one give the difference
    between normal java class and java bean

    Is every java bean is a java class

    DB:3.53:Can Any One Give The Difference j1

    A java bean is a class (always)

    A class does not have to be a java bean:

    For a bean you need to have a no argument constructor
    follow any of the other java bean guidelines/requirements...

    http://java.sun.com/developer/onlineTraining/Beans/index.html

  • RELEVANCY SCORE 3.50

    DB:3.50:Diffrence Between Abstract Class And Stack ca


    Can any one tell me the keydifferencebetween Abstract Class Stack ??

    Thanks.
    Rhythm

    DB:3.50:Diffrence Between Abstract Class And Stack ca

    They are entirely different concepts, so there isn'ta key difference I can think of. Maybe I'm missing something, care to elaborate?
    Thanks
    --mc

  • RELEVANCY SCORE 3.50

    DB:3.50:Abstract Class And Interface???? ja


    hi all, i would like to know the difference between abstract class and interface....could anybody enlighten me on this....

    DB:3.50:Abstract Class And Interface???? ja

    search the forums, lot's of times answered this one has been.

  • RELEVANCY SCORE 3.49

    DB:3.49:Difference B/W Abstract &Amp; Interface dx


    Anyone tell me 4 difference b/w abstract class and interface
    plz help me

    DB:3.49:Difference B/W Abstract &Amp; Interface dx

    Asking once is enough.
    http://forum.java.sun.com/thread.jspa?threadID=734361

  • RELEVANCY SCORE 3.48

    DB:3.48:Difference Between Iserviceprovider And System.Iserviceprovider f8


    I'm a newbie to vs shell package development.

    public abstract class Package : IVsPackage, IServiceProvider, IOleCommandTarget,   

    IVsPersistSolutionOpts, IServiceContainer, System.IServiceProvider,   

    IVsUserSettings, IVsUserSettingsMigration, IVsToolWindowFactory{    ...} 

    DB:3.48:Difference Between Iserviceprovider And System.Iserviceprovider f8

    The System.IServiceProvder is an interface defined by .NET, and is analogous though not identical to the IServiceProvider interface from COM. Both of these interfaces are identified by different guids.Consequently, you will see a lot of code redefining the COM version of this interface as IOleServiceProvider.In the context of .NET constructs, System.IServiceProvider is typically used. In the context of COM interop (which the core VS IDE is based) it's the Win32/COM version that's typically used.Sincerely,Ed Dore

  • RELEVANCY SCORE 3.47

    DB:3.47:Can An Abstract Class Extend Another Abstract Class? p1


    Is it possible for an abstract class to extend another abstract class?

    Say
    public abstract class AComponent extends JComponent {
    }

    Thanks.

  • RELEVANCY SCORE 3.46

    DB:3.46:Situation That Describes Difference Between Usage Of Inetrface And Abstract Class x8


    Hi,
    Can anybody please tell me the best example or situation where we can chosse between interface and abstract class?Thanks, Smiley:)

    DB:3.46:Situation That Describes Difference Between Usage Of Inetrface And Abstract Class x8

    Hi Smiley3,
    I am marking this issue as Answered. If you have any new questions or concerns about this issue, please feel free to let me know.
    Thank you and have a nice day!Min Zhu [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

  • RELEVANCY SCORE 3.46

    DB:3.46:I Dont See Any Difference Between Abstract Method And Abstract Factory -Have You Find Any Difference ( Both Of Them Decouples The Client From Object Creation) 87


    I dont see any difference between Abstract method and Abstract factory - both of them decouples the client from object creation.
    If anybody knows the actual difference please explain me with differences
    Also i dont understand families of related or dependent object ..why we need to create families of related objects instead we can simply go for factory method rite ?

    Abstract method:- http://www.c-sharpcorner.com/uploadfile/kalisk/factory-method-design-pattern-using-C-Sharp/
    Abstract factory :http://lasithsameera.blogspot.com/2010/07/abstract-factory-pattern-with-c-code.html

    look at the above code...both samples are looks similar except in the Abstract factory delegates the object creation to another class..thats the only difference i can see.....Any thoughts?

    ilikemicrosoft

    DB:3.46:I Dont See Any Difference Between Abstract Method And Abstract Factory -Have You Find Any Difference ( Both Of Them Decouples The Client From Object Creation) 87

    I dont see any difference between Abstract method and Abstract factory - both of them decouples the client from object creation.
    If anybody knows the actual difference please explain me with differences
    Also i dont understand families of related or dependent object ..why we need to create families of related objects instead we can simply go for factory method rite ?

    Abstract method:- http://www.c-sharpcorner.com/uploadfile/kalisk/factory-method-design-pattern-using-C-Sharp/
    Abstract factory :http://lasithsameera.blogspot.com/2010/07/abstract-factory-pattern-with-c-code.html

    look at the above code...both samples are looks similar except in the Abstract factory delegates the object creation to another class..thats the only difference i can see.....Any thoughts?

    ilikemicrosoft

  • RELEVANCY SCORE 3.46

    DB:3.46:Diffrence Between A Interface And A Abstract Class? f7



    Hi OO ABAP Gurus

    Please clear below point to me.

    Diffrence between a Interface and a abstract class?

    Many thanks

    Sandeep Sharma..

    DB:3.46:Diffrence Between A Interface And A Abstract Class? f7


    Interface:

    All the methods of the class ARE UNDEFINED. You need to implement the interface in a class and give the method definition now. In other words INTERFACES just have the declarations no definitions.

    Abstract Class:

    All the methods which are defined for the class may have the definition or may not. Say we have 3 methods defined for this particular abstract class but only 2 have the definition and 1 does not have the definition. Then it becomes the abstract class.

    So, every Interface is a abstract class but not every abstract class is interface.

  • RELEVANCY SCORE 3.44

    DB:3.44:Re: Difference Between Abstract Class And Interface 7k


    See reply #44 and then please find something more useful to do.

    DB:3.44:Re: Difference Between Abstract Class And Interface 7k

    Passionate_Java_Lover_Vijay wrote:
    hi tigers,
    i am very new to java.
    i have a doublt iin collection.
    at wht situation what interface wil be best than other.

    where should i use List Set, Map and all.
    Advance thanks 2 guys who help me.

    Thanks
    ThinkGodJebus. Are you for real? Get a grip will you

  • RELEVANCY SCORE 3.44

    DB:3.44:Confusion Between Abstract And Interface a8


    Hi all,
    i'm new to java, can somebody help to explain on abstract and interface method. As i know that abstract or interface does not provide implementation in the superclass and interface class respectively. All the implementation are done in subclass.. why not we use the inheritances and abstract method to solve the problem instead of using the interface... i can't see the difference between the abstract and interface.. can somebody provide me a good example to understand the interface well..

    p/s: pls correct me if i wrong... ;)
    thanks

    DB:3.44:Confusion Between Abstract And Interface a8


    public class abstract Mainclass{
    abstract double area();
    abstract double meter();
    }

    public class Subclass1 extends Mainclass{
    double area(){
    return 5+1;
    }
    }

    public class Subclass2 extends Mainclass{
    double area(){
    return 8+10;
    }
    }Let's say you have
    public class abstract AreaClass {
    abstract double area();
    abstract double meter();
    }And then when you are working on your second iteration and you want to use Dimension class for this purpose for your new code but you want to leave the old code alone. If you have made AreaClass an abstract class, this is impossible.
    public class AreaDimension extends AreaClass, Dimension {
    }will not compile. However if you had defined AreaClass as and interface you can do this:
    public class AreaDimension extends Dimension implements AreaClass {
    double area() {
    return height * width;
    }
    }Then you can pass this to any method that accepts an AreaClass as a parameter and you can also pass it to any method that takes a Dimension.

  • RELEVANCY SCORE 3.44

    DB:3.44:Diff. Between Interface And Abstract Class 8j


    hi,
    Can any one tell me about diff between interface and abstract class in practical way.advanced thanks for ur response.
    -PVMVS

    DB:3.44:Diff. Between Interface And Abstract Class 8j

    An interface is a way to specify a set of abstract methods that you want a class to implement. The big deal is that the compiler will check that the methods are in fact provided by the class.

    Interfaces almost always represent a view that has nothing to do with the class hierarchy. It could for example be a specific way to access data, like an iterator. Iterators have seldom anything to do with the logical class design. It's just a common way to iterate through the elements of any class.

  • RELEVANCY SCORE 3.39

    DB:3.39:Abstract Class Inheriting Another Abstract Class ck


    If I have an "Abstract" class that has the following methods:

    Abstract A
    getX();
    abstract getY();
    abstract getXY();And, another "Abstract" class that "INHERITS" A:

    Abstract B extends AWill the "Abstract" methods in class A be ALSO "Abstract" in class B?

    Thanks.

    DB:3.39:Abstract Class Inheriting Another Abstract Class ck

    Think about it: the alternative would be they are no longer abstract methods -- so where did their mystery bodies come from?

  • RELEVANCY SCORE 3.37

    DB:3.37:Diference Between Abstract Class And Interface cp



     
    Hi,
     
    I had a doubt on basic concept of interface and abstract class.
     
    I had idea of wht is interface and abstract class but there is case ,can any do justification on these case is
     
    Abstract class is a clas where some methods r defined and some are abstract methods.
    Interface is where all methods are abstract .
     
    but what happen if i try to maintaince all methods in abstract class as abstract which is equivalent to interface.?
     
    We go for abstract class if want to extend functionality of class.For interface if we wanna implement a new implementation.
     
    is there any other difference apart from this and other issues if we try to have all methods abstract .
     
     
    With regards
    Mahender

    DB:3.37:Diference Between Abstract Class And Interface cp

    Hi,
     
    Thnx for giving info.Actually iam looking for projct development point of view..In whihc cases i do go 4 developing abstract classes  other interfaces

  • RELEVANCY SCORE 3.37

    DB:3.37:What Is The Difference Between Abstract Class And Interface af


    hi,recently i went for an interview they ask me what is abstract class ,interface and its difference
    I said abstract class contain abstact method ,abstract method is a method with no body.Abstract class cannot be instantiated.Abstract class is a base class it required derived class for the implementation of method.
    Interface is a syntactical contract that all derived class should follow
    it define properties ,method,events which are known as member of interface.
    Then They asked me what is the difference between them. I said
    abstract class interface
    1.abstact class can implement method 1.interface cant
    2.abstact class can contain constructor, 2.interface cant
    destructor
    3.abstract class cannot support multiple 3.interface support
    inheritance
    etc
    Then they said some different answer I said dont no.
    Then they ask me when i should make abstract class for an project and when
    i should make interface.
    I said if suppose there is two class which must be having method with different logic then we sholud make abstract class.
    and if suppose we have two class having method .with different logic then we can make interface .
    Am i correct with my explaination.if not correct me .please provide me that when should we create abstract class and interface and what is difference .please help me

    DB:3.37:What Is The Difference Between Abstract Class And Interface af

    I would focus the answer on the distinction that you cant add an abstract class to an existing class like you can an interface.

  • RELEVANCY SCORE 3.36

    DB:3.36:Abstract Class &Amp; Interface 17


    What is the difference between Abstract Class and Interface Class? What I understood is both has to be defined in the subclass i.e methods. Apart from that Interface supports multiple inheritance whereas Abstract class doesn't. When both has to be defined in the subclass and interface supports multiple inheritance why we still need Abstract Class.

    Thanks in Advance,
    R.Ravindhran

    DB:3.36:Abstract Class &Amp; Interface 17

    A class can only extend one other class (Abstract or not) but it can implement any number of interfaces.

  • RELEVANCY SCORE 3.36

    DB:3.36:Re: Difference Between Abstract Class And Interface. f3


    Thanks, jverd. I have got it.

    George

  • RELEVANCY SCORE 3.36

    DB:3.36:Diff Between Interface And Abstract Class 9a



    Hi to all,

    I am woking on OOP in ABAP .Could any one can tell the difference between interface and abstract class.

    thanks in advance .

    DB:3.36:Diff Between Interface And Abstract Class 9a


    Hello Sagar,

    like Uwe told one basic difference is that you may provide some methods with an abstract class but not with an interface. The unique feature of interfaces is that you may implement several ones while abstract classes are limited to one inheritance hierarchy.

    Regards

    Klaus

  • RELEVANCY SCORE 3.35

    DB:3.35:What Is The Main Difference B/W Interface And Abstract Class 83


    is there any specific difference b/w interface and abstract class. if wht is tht? and how?

    DB:3.35:What Is The Main Difference B/W Interface And Abstract Class 83

    abstract class can be have methods with body

    interface cannot

    interface is 100% abstract class

  • RELEVANCY SCORE 3.35

    DB:3.35:Query On Abstract Class jj


    is it possible to extend an abstract class?

    DB:3.35:Query On Abstract Class jj

    All you need for a utility class all you need is a private constructor. e.g. the Math class
    You can have utility class which is abstract or final class as well.
    It just that abstract is usually meant for classes with abstract methods so it could be more confusing than useful.

  • RELEVANCY SCORE 3.35

    DB:3.35:Interfaces And Abstract Classes 73


    can anyone pls tell me where exactly an abstract class is used and where exactly an interface is to be used.

    i think the main difference between an abstract class and an interface is that an interface will have all the abstract methods whereas an abstract class can have one or more abstract methods--- if i am not wrong.
    anything to add? -- pls let me know on this....

    and also how they might be useful for us....

    DB:3.35:Interfaces And Abstract Classes 73

    The differences are already quoted. In addition of that
    the abstract class will come in the class/system hierarchy, but interface will not.

  • RELEVANCY SCORE 3.35

    DB:3.35:Abstract Class 71


    Hi,
    can u tell me the exact difference between abstract class and interface.under which situations we should use this.

    DB:3.35:Abstract Class 71

    AmitChalwade123456 wrote:
    Anumanick wrote:
    Hi,
    can u tell me the exact difference between abstract class and interface.under which situations we should use this.A class implementing an interface must implement all of the methods defined in the interfacepublic abstract class ImNotImplementingThat implements Runnable {

    // public void run() {} I was going to implement this, but I can't be bothered

    }while a class extending an abstract class need not implement any of the methods defined in the abstract class. public class WhyAreYouMoaningAboutRead extends java.io.InputStream {

    // I won't compile, because I'm not implementing the abstract void method 'read'

    }Additionally, a class extending an abstract class can implement an infinite number of it's own methods.Erm

    An abstract class can contain non-abstract methods which do not have to be overridden in the subclass.Indeed

  • RELEVANCY SCORE 3.34

    DB:3.34:Abstract Class And Interface mc


    From the design perspective what is the difference between Abstract class and Interface.
    If we are providing design, for a system. When should we use abstract class? and when should we use interface.

    DB:3.34:Abstract Class And Interface mc

    And,
    you can only "extends" one abstract class;
    but "implements" several interfaces.

  • RELEVANCY SCORE 3.34

    DB:3.34:Abstract Class Vs Interface And Importance Of Using xm



    Hi All,

    I want to know what is the difference between Abstract class and Interface.

    and what is the importance of using them.

    Moderator message: please search for available information/documentation.

    Edited by: Thomas Zloch on Sep 27, 2011 1:55 PM

    DB:3.34:Abstract Class Vs Interface And Importance Of Using xm


    Please refer to this thread, already this is discussed in forums

    [ABAP Objects.. Abastract Interface Class;

    Thanks

    Pavan

  • RELEVANCY SCORE 3.34

    DB:3.34:What Is The Difference Between An Abstract And An Interface Class? pk


    can anyone enlighten me on this, what is the difference between an interface and an abstract class? When should i use an interface instead of a class and vice-versa? thanks!

    DB:3.34:What Is The Difference Between An Abstract And An Interface Class? pk

    public class Test extends MyClass implements MyInterface {
    public Test() {
    someAbstractMethod();
    someInterface();
    someMethodInAbstractClass();
    super.someMethodInAbstractClass();
    }
    public static void main(String[] args) {
    Test foo = new Test();
    }
    public void someAbstractMethod() {
    System.out.println("someAbstractMethod() in Test");
    }
    public void someInterface() {
    System.out.println("someInterFace() in Test");
    }
    // public void someMethodInAbstractClass() {
    // System.out.println("someMethodInAbstractClass() in Test");
    // }
    }

    abstract class MyClass {
    public void someMethodInAbstractClass() {
    System.out.println("someMethodInAbstractClass() in MyClass");
    }
    public abstract void someAbstractMethod();
    }
    interface MyInterface {
    public void someInterface();
    }Run once, uncomment code, run again, compare output

  • RELEVANCY SCORE 3.34

    DB:3.34:Difference B/W Abstract Class And Interface mf


    Hi,
    can anyone tell the difference between Abstract class and an Interface?

    Thanks in advance!

    DB:3.34:Difference B/W Abstract Class And Interface mf

    The majoor diiffernce is that Interface canot ber
    inherited while absract calss can be inherited
    one abract class can iheret other abstract class
    while Interface doesnot???

  • RELEVANCY SCORE 3.34

    DB:3.34:What's The Difference Between Abstract Class And Interface? 1z


    Dear all,
    Can anyone give me some hints about this topic?

    Thanks.

    Leo

    DB:3.34:What's The Difference Between Abstract Class And Interface? 1z

    Also, you can only extend one class, but can implement many interfaces. I extend a class for true is-a relationships, I use implements like mixins.

  • RELEVANCY SCORE 3.32

    DB:3.32:Simple Query ac


    Difference between Abstract class and interface with practical example

    DB:3.32:Simple Query ac

    You are right; it was a simple query. (and I don't mean "simple" as in lacking complexity.)

  • RELEVANCY SCORE 3.32

    DB:3.32:Why We Use Interface? c9


    I appeared one of my interviews.The Interviewee asked me a question that

    Suppose one is abstract class and one is interface.
    All the methods of abstract class are abstract.
    Then on this level what is the difference between abstract
    and interface and why we use interface. I could not answer properly.
    Please guide me the actual difference between Abstract class and Interface.
    Thanks

    DB:3.32:Why We Use Interface? c9

    google is your friend! Dear You are also my friend ;)