• RELEVANCY SCORE 5.00

    DB:5.00:Abstract Class &Amp; Interface jp




    In which situation we use Abstract Class and in which situation we use Interface?

    DB:5.00:Abstract Class &Amp; Interface jp

    In which situation we use Abstract Class and in which
    situation we use Interface?It's a frequently asked question so search the forums.

    One answer is that from a pure typing perspective it doesn't matter because they're equal. The difference is that an abstract class can carry implementation, something an interface cannot. So pick the abstract class when you consider that beneficial.

  • RELEVANCY SCORE 5.00

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




    Hi friends,

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

  • RELEVANCY SCORE 4.86

    DB:4.86:Abstract Class And Interface 7x




    Hi,
    This is ramana, I got a doubt
    1. I have one interface
    interface Intabs {
    abstract void method1();
    abstract void method2();
    abstract void method();

    }
    2. Iam trying to convert that interface into abstract class like below
    interface Intabs {
    abstract void method1();
    abstract void method2();
    abstract void method();

    }
    3. Again iam trying to extend that abstract class into class like below
    interface Intabs {
    abstract void method1();
    abstract void method2();
    abstract void method();

    }

    Iam getting errors

    Can i do it in multiple steps: Interface------abstract class----- class

    DB:4.86:Abstract Class And Interface 7x

    Cannot reduce the visibility of the inherited method
    from IntabsDerabst1.java
    Right. As mentioned, you can't assign weaker access priveleges to inherited methods. If you define a method as "public void foo() {}", the "foo()" method must have at least public access in all subtypes. In your example, your interface methods are public, but you're trying to give them "package-private" (default) access in the abstract and concrete implementation classes.

    ~

  • RELEVANCY SCORE 4.76

    DB:4.76:Re: Abstract Class &Amp; Interface xp


    i posted a part of a pdf file for understanding about abstract classes and interfaces. trust me read it thoroughly and once you are finished you will say Ah.. that is why we use interfaces and abstract methods. This will give you a brief description on java inheritance, polymorphism and abstraction and interfaces.

    Good Luck

    DB:4.76:Re: Abstract Class &Amp; Interface xp

    Hai Ram! It is the batameeze leading the the
    batameeze!You mean budding budtameezee? ;)Yes budding. As in fungus that reproduce by budding. :-)

  • RELEVANCY SCORE 4.68

    DB:4.68:Extending Abstract Classes dp


    Hi all,

    is there a feature in JDev (= 9.0.3) that adds all abstract methods if I extend an abstract class? It's nearly the same feature like implementing an interface. I didn't find out how to do this for abstract methods. The Tools-Override Methods dialog doesn't show the abstract methods. :-(

    Cheers,
    Axel

    DB:4.68:Extending Abstract Classes dp

    Thank you, Frank.

    Now it worked for me, too. So it seems I've been too stupid ..

  • RELEVANCY SCORE 4.40

    DB:4.40:Why Interface Is More Preferable Than Abstract Class fp


    I am practicing java programming. I need your help.
    please any one tell me "Why interface is more preferable than abstract class".

    Thanks;

    skumar

    DB:4.40:Why Interface Is More Preferable Than Abstract Class fp

    An interface is typically used to describe peripheral abilities of a class. An abstract class defines the core identity of its descendant classes.

    A simple example would be:
    If Automobile is an abstract class, then Car class may extend the Automobile class and implement the Movable interface. This Movable interface can apply to several other totally unrelated classes as well. Thus implemented interfaces enumerate the general things a class can do, not the things a class is. Precisely, it describes the characteristics that the class will posses which may/may not be applicable to other unrelated classes also.

    By the same argument, a java process (say a background process) must implement the Runnable interface rather than extending teh Thread class because it is not really interested in providing some new Thread functionality, but rather just wants the code to have the capability of running independently.

    Hope this helps.

    Ms.Ganesan

  • RELEVANCY SCORE 4.26

    DB:4.26:Abstract Class And Interface 17



    Please tell me what is Abstract Class and Interface. Please explain with help of simple example and also tell me difference between them.

    DB:4.26:Abstract Class And Interface 17


    hi

    i will suggest u to refer some basic java book , to clear ur basic concept of OOPS , because these principal remain same for all languages that follow OOPS concept .

    and under standing these with java is easier then with ABAP .

    Abstract Class

    class which have atleast 1 method which is declared only , (no definition is given for it in this class is mentioned as Abstract Method )

    and that class is defined as Abstract class

    Interface :

    only declaration of method done here , no method will be defined here , class which will implement this interface will give definition .

    Diff. b/w Abstract Class and Interface :

    ABS Class can have method with there definition , but one method should be there with declartion only.

    Interface will have all method with out definition .

    hpoe this help u .

    reward if helpful.

  • RELEVANCY SCORE 4.26

    DB:4.26:Re: Interface m8


    Java Glossary : interface vs abstract class
    Abstract classes vs. interfaces: When does it make sense to choose an abstract class over an interface?
    Abstract classes and interfaces practicum: Move from theory to practice on when to employ abstract classes vs. interfaces
    Tech Tips: ABSTRACT CLASSES VS. INTERFACES

    DB:4.26:Re: Interface m8

    I'm still entertained by the fact that some folks will
    spell out words like "multiple", "inheritance",
    "interface", and "implement", but not "because".

    :o)LOL!

    This kills me - just bcuz.

    %

  • RELEVANCY SCORE 4.22

    DB:4.22: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:4.22: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 4.14

    DB:4.14:Abstract Class And Interface 3j


    I would covet to recognize at what situation we use abstract class
    and when to use interface?

    With Regards,
    Stalin.G

    DB:4.14:Abstract Class And Interface 3j

    http://www.google.com/search?q=abstract+class+interface+site:forum.java.sun.com

  • RELEVANCY SCORE 4.11

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


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

    Thanks in advance!

    DB:4.11: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 4.11

    DB:4.11:Abstract Class z3



    Hi to all,

    can any one tel me what are abstract classes and what hapens if i check the ABSTRACT ckeck box while creating a interface in se24(class builder)?

    Thanks Regards

    Priya

    DB:4.11:Abstract Class z3


    Thanks Matthew .

    Thanks Regards

    Priya

    Edited by: priya latha on Dec 19, 2007 11:43 AM

  • RELEVANCY SCORE 4.11

    DB:4.11: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.11

    DB:4.11: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.11:Differance Between Abstract Class And Interface 7s

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

  • RELEVANCY SCORE 4.02

    DB:4.02: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:4.02: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.99

    DB:3.99:Difference % Abstract Class And Interface? d3


    Hi,

    I am confused about abstract class and interface. For interface, the subclass has to implement all the parent class methods. But, it is no need in abstract class.

    However, in which situation should I use abstract class or interface?

    Thanks for explanation.

  • RELEVANCY SCORE 3.98

    DB:3.98: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.98: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.86

    DB:3.86:Abstract Class Needs To Implement Interface ms


    Hello, I have an interface and base abstract class defined as follows: interface IbusinessInterface{    void DoSth1();    void DoSth2();    void DoSth3();    void DoSth4();    void DoSth5();    ...    ...    void DoSthN();}public abstract class BaseClass : IBusinessInterface{    public abstract void DoSth1();    public abstract void DoSth2();    public abstract void DoSth3();    public abstract void DoSth4();    public abstract void DoSth5();    ...    ...    public abstract void DoSthN();} what is the reason that this abstract class needs to have methods of the interface implemented  ?Thanks, Michal

    DB:3.86:Abstract Class Needs To Implement Interface ms

    Look at the other side of the coin!  Think interface contract.  The abstract base class is NOT defining any default implementation for you.  Now, when you browse the abstract class you can SEE the member methods that are or not implemented without having to look any further.  Also, when the members of the abstract class are declared as abstract the IDE can generate method stubs for you automatically!  That does not happen if they are declared as virtual.

    Mark the best replies as answers. Fooling computers since 1971.

  • RELEVANCY SCORE 3.84

    DB:3.84:Question About Abstract Class mm


    2 questions
    1, can an abstract class implement an interface?
    2, i know an abstract class can extend other abstract classes, but can it extend a non-abstract class?
    Thank you for your time
    ~Gabor

    DB:3.84:Question About Abstract Class mm

    tjacobs01 wrote:
    BTW I suppose the final thing is also true of private classes, since they can't be extended.Y'know, if you're concerned about extending your privates, there are certain products on the market nowadays. I can forward you a slew of emails if you want.

  • RELEVANCY SCORE 3.84

    DB:3.84:Interface Vs Abstract Class x7


    Hi,
    Can anyone tell me where do we use an interface n where do we use an abstract class.
    (What is the need of either an interface or an abstract class in Java)

    DB:3.84:Interface Vs Abstract Class x7

    http://www.google.co.in/search?hl=enq=Interface+vs+Abstract+classbtnG=Google+Searchmeta=

    please USE appropriate an thread to POST ur topics.

  • RELEVANCY SCORE 3.84

    DB:3.84:Interface Vs Abstract Class ?? z1


    Are there any guidlines when to use Interface and when abstract class.
    Tried to dig in book but failed. Will appreciated any links.

    Thanks
    Mario

  • RELEVANCY SCORE 3.83

    DB:3.83:Core Java 83


    what is differernce between abstract class and interface?

    DB:3.83:Core Java 83

    jwenting wrote:
    maybe an attempt at counting only posts which make any kind of sense at all?Where did the '1' come from then?

  • RELEVANCY SCORE 3.83

    DB:3.83:Interfaces And Abstract Classes 8x


    Whats the difference between an interface and an abstract class.

    DB:3.83:Interfaces And Abstract Classes 8x

    Another trait that is often overlooked is that the abstract methods and constants declared in an interface are always public; with abstract classes, you can declare them (package) and protected scope as well.

  • RELEVANCY SCORE 3.83

    DB:3.83:What Is The Difference Between Abstract Class And Interface jf


    Hi,
    Can you please tell me the differences between Abstract class and Interface.
    In which scenarios we have to use Abstract class and in which scenarios should use Interface.

    Thanks and Regards
    Kranthi

    DB:3.83:What Is The Difference Between Abstract Class And Interface jf

    http://stackoverflow.com/questions/761194/interface-vs-abstract-class-general-oo

  • RELEVANCY SCORE 3.83

    DB:3.83:Interface &Amp; Abstract Class d3


    1whats the basic difference between an interface and an abstract class?
    when should one be using an interface or an abstract class?

    2whats the difference between method overriding and method overlaoding?
    does both of them has any relation with the instance of te class implementing them?

    DB:3.83:Interface &Amp; Abstract Class d3

    http://www.google.com/search?q=java+interface+%22abstract+class%22

    http://www.google.com/search?q=java+method+overloading+overriding

  • RELEVANCY SCORE 3.83

    DB:3.83:Re: Interface &Amp; Abstract Class ax


    This question has been discussed "up to the tilt" in the forums. Do some searching.

    DB:3.83:Re: Interface &Amp; Abstract Class ax

    I want to know that what are the major differences
    betwwen Interface and abstract classYou cannot fool me. This is the OO version of the Indian rope trick. Everybody asking this question vanish into thin air never to be heard from again.

  • RELEVANCY SCORE 3.83

    DB:3.83: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.83:Abstract Class And Interface???? ja

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

  • RELEVANCY SCORE 3.79

    DB:3.79:Which Is Faster,Interface Or Abstract Class? 9c


    Hi,

    I am not sure this was already asked,but i wanted to know wich is faster,using an interface or using an abstract class?

    Thanks,
    Sajjan Sarkar.

    DB:3.79:Which Is Faster,Interface Or Abstract Class? 9c

    Well, to be fair, when you mention "performance" to a newbie, they probably think of the nearest real-world example, which (arguably) is something like tuning an automotive engine. So they're going to look for things that seem like the programming equivalent of cleaning spark plugs.

    They haven't yet faced the way that algorithmic complexity can vary over wide ranges that have little real-world counterpart and may tax the imagination.

    Jon Bentley's book "Programming Pearls" is good to fix that.

  • RELEVANCY SCORE 3.79

    DB:3.79:Mdb Abstract Base Class And Ejb3 Annotations 1k



    I have following scenario where my MDB class extends an abstract class which implements the MessageListener interface.
    public abstract class MDBBase implements MessageListener {
    public void onMessage(Message message) {
    ....
    processJob(some-params)
    }
    public abstract void processJob (some-params);
    }

    public class MyMDB extends MDBBase {
    public abstract void processJob (some-params) {

    }
    }

    DB:3.79:Mdb Abstract Base Class And Ejb3 Annotations 1k


    I have following scenario where my MDB class extends an abstract class which implements the MessageListener interface.
    public abstract class MDBBase implements MessageListener {
    public void onMessage(Message message) {
    ....
    processJob(some-params)
    }
    public abstract void processJob (some-params);
    }

    public class MyMDB extends MDBBase {
    public abstract void processJob (some-params) {

    }
    }

  • RELEVANCY SCORE 3.79

    DB:3.79:When To Use Abstract Class And Interface 3z


    What is the scenario to use abstract class and interface

    DB:3.79:When To Use Abstract Class And Interface 3z

    Read this too, if you have time. :)
    http://java.sun.com/developer/JDCTechTips/2001/tt1106.html#tip2

  • RELEVANCY SCORE 3.79

    DB:3.79: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.79: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.79

    DB:3.79:Situation Where You Are Interface &Amp; Abstract Class? fj


    please let me know if any one knowns answer for the above question

    DB:3.79:Situation Where You Are Interface &Amp; Abstract Class? fj

    For a concrete example check out the Collections API.

    List is defined as an Interface
    They also define an AbstractList class which provides a lot of the common functionality for a List.

  • RELEVANCY SCORE 3.79

    DB:3.79: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.79: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.79

    DB:3.79:Re: Where We Use Abstract Class &Amp; Interface... ks


    georgemc wrote:
    valooCK wrote:

    Why should fruit be an abstract class?you must try it in order to know it:) you have to use an abstract class, you can not do it in a regular class. try it:)Meaningless garbage. Why can fruit not be an interface, for example? What can you do with an abstract class that you can't do with a concrete class, and how do you see that being relevant to "fruit"?technically, interfaces and abstracts are quite the same, their differences are mostly in where they are used. an interface exposes a special interface for contracting purposes. a class that implements it can have a smaller or bigger or exactly the same interface. an abstract class however, represents an abstract notion. fruit, number, food are some examples of abstract notions in real life. they do not exist. they can only be represented partially by a concreate example. an apple, an orange etc can represnt the abstract notion of fruit. the number 1, 2,3 etc can represent the notion of number. but neither number nor fruit actually exists. an abstract class is designed for that purpose, functionally better than an interface for this purpose, although technically an interface works as well.

    by the way, were you verdy?

    DB:3.79:Re: Where We Use Abstract Class &Amp; Interface... ks

    vanilla_lorax wrote:
    cotton.m wrote:
    If you have no idea what I am talking about http://www.youtube.com/ValooChickenVillageWhat.
    The.
    Holy.
    Hell.and you will be in this hell. have a nice weekend.

  • RELEVANCY SCORE 3.79

    DB:3.79:Why Interface Is More Preferable Than Abstract Class p9


    I am practicing java programming. I need your help.
    please any one tell me "Why interface is more preferable than abstract class".

    Thanks;

    skumar

    DB:3.79:Why Interface Is More Preferable Than Abstract Class p9

    Double-post
    http://forum.java.sun.com/thread.jspa?threadID=643081

  • RELEVANCY SCORE 3.79

    DB:3.79:Abstract Class And Interface z1


    What is most important thing about abstract class and interface.

    When to use abstract class and interface.

    DB:3.79:Abstract Class And Interface z1

    The interface is like an agreement where the class
    which implements the interface promises to write the
    implementation code for all the functions in the
    interface.Same for an abstract class, only, rather than "all the methods" it's "all the abstract methods." Of course, you could turn around and usethat wording for interfaces too, but in that case it means "all the methods" since interfaces' methods are all abstract.

  • RELEVANCY SCORE 3.77

    DB:3.77:Abstract And Interface? cm


    why do we need abstract class?
    why do we need interface in java?

    DB:3.77:Abstract And Interface? cm

    Oh please, do some research of your own.

  • RELEVANCY SCORE 3.75

    DB:3.75:Dificult To Understand Interface And Abstract Class 98


    - I need explain what is better to use, interface or abstract class to inherit of square/rectangle.
    Example included is appreciated. Thanks.

    DB:3.75:Dificult To Understand Interface And Abstract Class 98

    Thank you for help me.
    Do you have a classe de rectangle and square?

  • RELEVANCY SCORE 3.73

    DB:3.73:Abstract Class Or Inteface 89


    Pls give me some practical example of choosing among abstract class and interface.

    DB:3.73:Abstract Class Or Inteface 89

    Search these forums using the box on the left. This question is asked about 50 times a week, there are tons of answers around

  • RELEVANCY SCORE 3.72

    DB:3.72:Interface Vs Abstract Class sa


    when would you create an interface as opposed to an abstract class?

    DB:3.72:Interface Vs Abstract Class sa

    An interface solves the problem of multiple inheritance in Java. A class can only extend from one other class, but can implement multiple interfaces. I link to think of extending in a vertical fashion ( among a class hierarchy ), and interfaces in a horizontal fashion ( across classes that may have nothing in common ).

  • RELEVANCY SCORE 3.69

    DB:3.69:What Is The Difference Between Abstract Class And Interface ? dd


    Hi,

    Could u plz tell me the difference between Abstract class and Interface?

    Thanks in advance.

    Gopi

    DB:3.69:What Is The Difference Between Abstract Class And Interface ? dd

    Lots.

    An abstract class can contain some method implementations, or indeed all the method implementations. It may contain methods with all the various access modifiers. It cannot be instantiated. A class may inherit from only a single abstract class.

    An interface contains only public method stubs and constants. A class may implement multiple interfaces. An interface cannot (obviously) be instantiated.

    Abstract classes are particularly useful when you need to provide a semi-complete implementation for reuse. Interfaces are used more like types.

    Look at java.util.* for some good examples of the use of both.

  • RELEVANCY SCORE 3.69

    DB:3.69: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.69: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.69

    DB:3.69:Interface ck


    Can u Explain me the defintion for interface, abstract class

    DB:3.69:Interface ck

    From the Java Tutorial:
    Interface: http://java.sun.com/docs/books/tutorial/java/interpack/interfaces.html
    Abstract Class: http://java.sun.com/docs/books/tutorial/java/javaOO/abstract.html

    Main tutorial page: http://java.sun.com/docs/books/tutorial/index.html

  • RELEVANCY SCORE 3.68

    DB:3.68:Public Abstract Interface Filterconfig pf


    public abstract interface FilterConfig

    what is this class actually . is it abstract class or interface?

    DB:3.68:Public Abstract Interface Filterconfig pf

    interfaces are abstract because you cannot
    instantiate them.

    like you cant instantiate a abstract class.It's the other way around. You cannot instantiate them because they're abstract. Only what's fully concrete can be instantiated.

  • RELEVANCY SCORE 3.68

    DB:3.68:Abstract Class With Abstract Methods Only p7


    Hi,

    What if you had an Abstract class with only abstract methods? How would that be different from an interface? In such case which needs to be chosen?
    I know that abstract class without concrete methods may be a design problem and exists very rarely. But if that was the situation , whether we need to go with
    interface or abstract class? Please clarify.

    Thanks.

    DB:3.68:Abstract Class With Abstract Methods Only p7

    EJP wrote:
    Not really. I see the Java API has many ones that both have abstract and concrete methods.The second statement is irrelevant to the first statement. You have misunderstood what you are saying 'not really' to.Sorry, English is not my native language.

  • RELEVANCY SCORE 3.68

    DB:3.68:Urgent Please 81


    Hi,

    What is the diff betw an abstract class and interface and in what situtations can i use abstract class and in what situations can i use interface.
    Please can any one help me.

    DB:3.68:Urgent Please 81

    Thank you very much sir,
    Now you gave nice explanation.
    Now i am clear with interface and abstract class.

    If you don't mind may i ask one more question.

    Please can you tell me

    what is the diff betw HashTable, HashTree and HashMap.

  • RELEVANCY SCORE 3.68

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


    8000 views already wow.

    DB:3.68: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 3.68

    DB:3.68:What Is An Interface &Amp; Abstract Class ? zm


    hi ,
    i am new to java,
    pls give the answer for this question,

    what is an interface abstract class ?
    why we go for interfaces and abstract classes?

  • RELEVANCY SCORE 3.68

    DB:3.68: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:3.68: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 3.67

    DB:3.67:Abstract Class And Interface x7


    Hi,
    Can anyone explain why we use abstract class and interface
    and when we use abstract class and interface
    and which one is best to use
    please explain in simple words
    waiting for reply.....

    DB:3.67:Abstract Class And Interface x7

    Abstract classes and interfaces are very similar. In languages that support Multiple Inheritance (like native C) abstract classes are what is used for/instead Interfaces.
    Allas, Multiple Inheritance is a ugly thematic (for the guy who writes Compilers and for the programmer that writes the code). And hence the developers of .NET decided:
    A class can only inherit from on base class. For everything else, use interfaces. (they propably took that directly from Java) It is not the worst decision by the way, Polymorphy with Multiple Inheritances really is a headache (1-2 chapters in each C
    book).

    The differences are:
    A abstract class has to be in the Inheritance Chain.
    A abstract class can code out any functions and methods it defines. This includes (even if that may sound contra-intuitive) the Constructor (it is to be called using base()). It does not have too.
    A abstract class can define public Varriables. But with the advent of properties (wich are short syntaxes for Functions), this became mostly irrellevant.

    A Interface can't be part of the Inheritance Chain (but in a way Interfaces can inherit other interfaces, creating Interface chains).
    A interface can't code out any functions. It can only provide the signature (name, parameter types, return type).
    As properties are little more then a neat way to write get- and set-functions, a Interface
    can contain properties.
    What they have in similar:
    Neither can be instantiated.
    Both can be used as Varriable types (so it does not matter wich implementation of this Interface/A-Class you have). Indeed downcasting to the Abstract or Interface type is what you most often see them used for.
    Both force class that Inherit/Implement them to provide code for the Functions. You don't need to know how a IComparable figures out wich Instance is higher then the other. Nor how exactly a SQLConnection opens the Connection. You only need to know is has
    a Compare() and Open() Function respectively.
    When to use Abstract classes:
    You want thsi thing to be part of the Inheritance Chain.
    You want this Functionality to be the main job of whatever inherits from it. Example:
    DBConnection. The abstract baseclass of things like SQLConnection. The designers decided that a DBConnection should not also be a Window/Form. A DBConnection should be
    created for it's specific task (connecting to a DB), be used and then be thrown away (or in this case Diposing would be even better). Allowing it to be also a Window would only risk keeping it in memory to long wich can be uggly as it uses unmanaged resources.
    A similar example is
    Stream, the baseclass of FileStreams, memoryStreams and the like. You will find this often whenever dealing with input/umnaged resources.

    When to use Interfaces:
    Everytime you don't need an Abstract class. Or even the other way: Only use abstract classes is you really need them/want them.

    Interfaces are ideal for small functionality. For example,
    IComparable. When a class implements IComparable it can be sorted by the .Sort() function of a list. Yet, being sortable is not the main function of this class. It's job is propably to contain multiple data fields as a unit. Being sortable is just a small
    functionality to be added. But as long as this functionality is added by providing Code for IComparable.Compare(), it can be sorted! The writer of List did not need to know how it works. Just the return values are of interest.Let's talk about MVVM: http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/b1a8bf14-4acd-4d77-9df8-bdb95b02dbe2

  • RELEVANCY SCORE 3.67

    DB:3.67:Why We Use Interface And Abstract Class mm


    hi,
    please explain me why and whenweneed to use interface and abstract class with real life example

    thanks in advance

    DB:3.67:Why We Use Interface And Abstract Class mm

    Hi Nitin,
    Here is major usage why we use Interface and abstract class, Interface need to be implement in small units but abstraction class needs to implement in large units. More clarifications is under below:
    1. Definition of
    Interface Class with sample.
    2.Definition ofabstraction class with sample.
    3.
    Difference betweenabstraction Interface class.
    Hope it will help you.
    thanks,

  • RELEVANCY SCORE 3.66

    DB:3.66:Abstract Class 13


    Difference between abstract class and interface
    use of abstract class

    DB:3.66: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 3.65

    DB:3.65:Abstract Class And Interface 1d


    Hi,

    What is the diff betw an abstract class and interface and in what situtations can i use abstract class and in what situations can i use interface.
    Please can any one help me.

    DB:3.65:Abstract Class And Interface 1d

    Also a class can only extend one abstract class, but it can implement multiple interfaces. You can also do both at the same time, but you can never extend more than one abstract class

  • RELEVANCY SCORE 3.64

    DB:3.64:Abstract Class Vs Interface 9d


    Hi

    I was just wondering what is the advantage of using an abstract class over interface. In what situation, using an abstract class is more suitable than using interface? and vice versa?

    DB:3.64:Abstract Class Vs Interface 9d

    This question has been asked and answered a million times. For instance, see this thread: http://forum.java.sun.com/thread.jsp?forum=31thread=352322

  • RELEVANCY SCORE 3.63

    DB:3.63: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.63: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.61

    DB:3.61:Interface And Abstract Class c3


    why we have constructor for abstract class and not for interface,

    DB:3.61:Interface And Abstract Class c3

    http://forum.java.sun.com/thread.jspa?messageID=10174604

    Double your pleasure or not!

  • RELEVANCY SCORE 3.60

    DB:3.60:Interface Vs Abstract Class sz


    Let say that an abstract class has all abstract functions and someone use it instead of interface.
    What are the disadvantage and advantages?
    I know one that he cannot do multiple inheritance, hence he cannot extends abstract class and use any other parent Class. However, I wish to know more disadvantage/advantages.

    Looking forward for your input.

    --
    PS: I know interface cannot have code and abstract class could have code (non-abstract) methods.

    .

    DB:3.60:Interface Vs Abstract Class sz

    HowToDoIt wrote:
    Let say that an abstract class has all abstract functions and someone use it instead of interface.
    What are the disadvantage and advantages?
    I know one that he cannot do multiple inheritance, hence he cannot extends abstract class and use any other parent Class. However, I wish to know more disadvantage/advantages.

    Looking forward for your input.

    --
    PS: I know interface cannot have code and abstract class could have code (non-abstract) methods.

    .An Interface expresses a contract.
    A class implementing an interface is saying "I will supply implementations of all methods described in the interface, i.e. methods with those particular signatures"

    A class can of course implement multiple interfaces, i.e. it is capable of fulfilling multiple contracts.

    An Abstract class is used to provide a 'base' implementation of some specific functionality (whether it is described in an Interface or not).

    I cannot think of a useful purpose for an abstract class that contains only abstract methods (perhaps it inherits some behavior from its base class)

    Usually some methods in an abstract class WILL be implemented, either because they are unlikely to change in child classes, or they provide a guide/example of implementation, or the implemented methods may be defined in terms of some of the abstract methods, this allows classes which extend the abstract class to 'mix in' their behavior with that of the base abstract class.

    So Interface and Abstract Class have two distinct and separate purposes.

    I hope that is clear?

    Just to help with the details, you can put more than just method signatures in an interface, your could for example have in your interface

    public interface Face1
    {
    public static final int x = 3;
    }which you would access as:

    int fred = Face1.x;And you can place a public static class inside of your interface, the methods of which you would access in a similar way, but you should avoid this unless you really know what you are doing.

  • RELEVANCY SCORE 3.60

    DB:3.60: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.60: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.58

    DB:3.58:Abstact Class Or Interface d3


    why would one use an abstract class versus an interface?

    DB:3.58:Abstact Class Or Interface d3

    MachBork wrote:
    why would one use an abstract class versus an interface?Don't you think think that this has been asked here in this forum, oh say a gazillion times? Please learn to search the forum for all the many threads on this and other questions.

  • RELEVANCY SCORE 3.56

    DB:3.56:Interface Or Abstract Class 1k


    Hi all, I am not sure when should I go for an interface and when should I go for an abstract class(both are abstractions ultimately)? Can anyone please give instance(s) where I should use an interface and not an abstract class and vice versa? Regards, Sandip

    DB:3.56:Interface Or Abstract Class 1k

    Hi TimJim,Thanks for your insight. I think even the following link is also quite good -http://social.msdn.microsoft.com/Forums/en-US/vblanguage/thread/511cce83-3b58-495d-8198-1df8bdc49fd0/Regards,Sandip

  • RELEVANCY SCORE 3.56

    DB:3.56:Make Abstract Class With Interface. 39


    I want to make an abstract class with methods that need interfacing, but I don't want to make an entire other class for the abstract class to implement. Is there any way to make an abstract class and interface combined into one class with no implementations on that class?

    DB:3.56:Make Abstract Class With Interface. 39

    if you want a class with no implementations that what you need is an Interface

  • RELEVANCY SCORE 3.56

    DB:3.56: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.56:Interface And Abstract Class ac

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

  • RELEVANCY SCORE 3.56

    DB:3.56:Use Of Abstract And Interface? k3


    when i use Abstract class or Interface.Which one is better?

    DB:3.56:Use Of Abstract And Interface? k3

    Depends on what you want to do. An interface is more general (in that it doesn't define any actual behavior) and allows you to mimic multiple inheritance (a class can implement any number of interfaces whereas it can only extend one class (abstract or otherwise)). Abstract is good if you have a common base of functionality that all of the implementers will be using.

    It's also fairly common to use both (i.e. the interface TableModel and the abstract class AbstractTableModel), so that someone who wants to completely write their own implementation is free to, while someone who wants to just extend or change the standard functionality could do that as well.

  • RELEVANCY SCORE 3.55

    DB:3.55:Difference Between Interface And Abstract Class a1


    Hi sirs,

    Give me the differences between interface and abstract class
    and when we go for interfaces and abstract class in developing an application

    DB:3.55:Difference Between Interface And Abstract Class a1

    An interface is a 100% abstract class, which means it doesn't contain any code, just method names and signatures. You use abstract classes when you want some code to be shared among the inheritors.

    The advantage with interface is that a class can implement as many interfaces as you like, while it can only extend one (abstract) class.

    So, you use interfaces when you need to extend other classes or doesn't want any code shared, and abstract classes when you don't want to extend other classes, and would like to share some code.

  • RELEVANCY SCORE 3.50

    DB:3.50:Abstract Class Or Interface. Which One Is Better 77


    hai everybody,

    i have a confusion between choosing of abstract class or Interface.

    abstract class Abstra
    {
    public abstract void abst();
    }
    interface Inter
    {
    public abstract void inter();
    }

    looks almost same !!!
    which one of above is better to inherit for a class.
    and more importantly why ?
    Everybody says it's interface....but i dont understand what could be the reason.
    i want to know the reason if interface is better as compare to abstract class.
    why ? why ? why ? why ?

    DB:3.50:Abstract Class Or Interface. Which One Is Better 77

    a very good answer...get to know first of all whats the difference between Abstract class and Interface.

  • RELEVANCY SCORE 3.50

    DB:3.50:When Would You Use An Abstract Class Versus Interface ? zc


    Hi guys

    When would you guys use an Abstract Class versus and Interface ?

    Stev

    DB:3.50:When Would You Use An Abstract Class Versus Interface ? zc

    Another important distinction: declaring functions abstract in a base class not only forces the programmer to implement the function, but also allows messages to be routed to the implemented version.

    Given the shape example from before, the getArea call only works because abstract tells the compiler "hey look for a function prototype that matches this in the derived class"

  • RELEVANCY SCORE 3.48

    DB:3.48:Help With Interface And Abstract cs


    Hi all

    what is the difference between an interface and an abstract class??

  • RELEVANCY SCORE 3.48

    DB:3.48:Extend Abstract Class &Amp; Implement Interface, Different Return Type Methods mz


    abstract class X
    {
    public abstract String method();
    }
    interface Y
    {
    public void method();
    }
    class Z extends X implements Y
    {
    // Compiler error, If I don't implement both methods

    // If I implement only one method, compiler error is thrown for not
    // implementing another method

    // If I implement both the methods,duplicate method error is thrown by
    //compiler

    }The same problem can occur if both methods throw different checked exceptions,or if access modifiers are different..etc

    I'm preparing for SCJP, So just had this weired thought. Please let me know
    if there is a way to solve this.

  • RELEVANCY SCORE 3.48

    DB:3.48:Abstract Class And Interface 7s


    Hai,

    I want to know In which suituation i want to use abstract class and Interface in My Project

    Regards,
    John Jayaraj,
    +91 9865315105

    DB:3.48:Abstract Class And Interface 7s

    Use abstract classes when you need to evolve a hierarchy from a class with some hard coded methods and parameters that must be available for all it's subclasses, and when you don't need to use polymorphism :

    abstract class Papapa() {
    public SomeType somethingI;
    public SomeType somethingII;

    abstract public void methodI(); // must be implemented at subclasses
    abstract public void methodII();
    public void methodAvaiableForAllClasses() {
    do something;
    // you can call methodI and methodII here
    }
    }

    abstract classes also lets you define global variables to be used (i heard its faster than interfaces too, but I don't know enough about it to confirm).

    Interfaces in the other way around lets you play with polymorphism.

    class XXX implements YYY, ZZZ.
    Remember that in Java you can only extends one class (abstract or not).
    class XXX extends YYY, ZZZ would result in an error.

    A good way to get the felling where to use abstract classes and interfaces is reading the Collection API source code.

  • RELEVANCY SCORE 3.48

    DB:3.48:Difference j9


    difference between abstract class and interface

    DB:3.48: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 3.48

    DB:3.48:Abstact Class And Interface s9


    Hi,

    Any One Can Let me know the exact diff. Between the Abstract class and Interface.

    With
    BAbu

  • RELEVANCY SCORE 3.48

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


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

    DB:3.48: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 Interface And Abstract Class 71


    I'm confused on what is the difference of implementing n abstract class and inheriting an interface?

    DB:3.48:Difference Between Interface And Abstract Class 71

    Hi,
    i want to add a few more differences --
    1.The variable defined inside an interface is public, static and final means it's basically a constant,But in case of abstract class you can hide the variable in the implementation class means you can change the value of the variable.

    One very important thing about the these two feature is when to use what?
    Ans:If a group of object is having some common property such that they are not going to be changed over a period then create an Abstract class out of that property.But if only some object is having a common property but not all then create an interface out of that property and implement all that property in Subclass.

    Thanks.

  • RELEVANCY SCORE 3.48

    DB:3.48:Why Would You Ever Use An Interface Instead Of An Abstract Class? mz


    With an abstract class, you can have unimplemented methods and then implemented methods. With an interface, you can only have unimplemented methods.

    Can somebody tell me, then, why Joe Doe would want to use an interface over an abstract class?

    DB:3.48:Why Would You Ever Use An Interface Instead Of An Abstract Class? mz

    Can somebody tell me, then, why Joe Doe would want to
    use an interface over an abstract class?The main reason is a limitation in the Java inheritance model namely that you can inherit one class only but as many interfaces as you want. This can be characterized as: single inheritance of implementation but multiple inheritance of type. The latter is considered the most important in OO design so the fact that you can inherit implementation from from one source only isn't that much of a limitation really .

    So to make use of multiple inheritance of type in Java you need to use interfaces (and possibly one class).

  • RELEVANCY SCORE 3.48

    DB:3.48:Abstract Class Vs Interface 1x


    Hi I have a small doubt regarding this.
    When can i go for Abstract Class and When can i go for Interface.
    Anybody can help me?

    DB:3.48:Abstract Class Vs Interface 1x

    Hi I have a small doubt regarding this.
    When can i go for Abstract Class and When can i go for Interface.
    Anybody can help me?

  • RELEVANCY SCORE 3.48

    DB:3.48:Java Interfaces And Abstract Classed fc


    what is the difference between interface and abstract class?

    DB:3.48:Java Interfaces And Abstract Classed fc

    I suggest you try writing some code and see.

  • RELEVANCY SCORE 3.48

    DB:3.48:Abstract Class Vs Interface In Term Of Speed pd


    Hi guys,
    I read every whare abstract class are faster then interface because interface require extra in direction. i want to know about how compiler deals with interface and abstract class.
    Thanks

    DB:3.48:Abstract Class Vs Interface In Term Of Speed pd

    hi,gays i think doesn't matter for code speed, we don't live in stone era. The question is what is better solution interface or abstract class.there is my visionThanks in advice

  • RELEVANCY SCORE 3.48

    DB:3.48:Query Related With Abstract Class And Interface. pf


    Hi Friends,

    I am not able to understand when to use abstract class and when to interface? Could any one explain it with a suitable example.

    Thanks,
    Rakesh

    DB:3.48:Query Related With Abstract Class And Interface. pf

    abstract class you can have abstract methods and you can have your onw methods and it's implementations.

    interface never has implementation of it's methods.

    regards,
    cristian

  • RELEVANCY SCORE 3.48

    DB:3.48: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:3.48: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 3.48

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


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

    DB:3.48: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.48

    DB:3.48:Interface Vs Abstract Class 81


    hello
    what to use when between interface vs abstract class?
    and which one is better for decoupling and different version on software.
    regardsIt's Me

    DB:3.48:Interface Vs Abstract Class 81

    For a detailed discussion on this see:
    Abstract Class vs InterfaceJohn Grove - DSS, Senior Software Engineer

  • RELEVANCY SCORE 3.48

    DB:3.48: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.48:Abstract Class And Interface mc

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

  • RELEVANCY SCORE 3.48

    DB:3.48:Java Programming 33


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

    DB:3.48: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.48

    DB:3.48:Nested Interfaces And Abstract Methods zx



    Consider the following design:

    interface ZIF_INTERFACE_A.
    methods METHOD_A.
    endinterface.

    interface ZIF_INTERFACE_B.
    interfaces ZIF_INTERFACE_A.
    methods METHOD_B.
    endinterface.

    class CLASS_A_B definition abstract.
    public section.
    interfaces ZIF_INTERFACE_B
    abstract methods METHOD_B.
    interfaces ZIF_INTERFACE_A
    abstract methods METHOD_A.
    methods METHOD_C.
    endclass.
    class CLASS_A_B implementation.
    method METHOD_C.
    endmethod.
    endclass.

    DB:3.48:Nested Interfaces And Abstract Methods zx


    No, you don't have to manually do this while defining a similar global class. The class builder automatically maintains the order of the definition!

    Actually, I did have to do that. The class builder declared the interfaces in the wrong order.

    I only wrote the local classes to demonstrate the problem on this forum.

  • RELEVANCY SCORE 3.48

    DB:3.48:Abstract Class Vs Interface ak


    hi,
    i know this is a very simple question but pliz answer it with implementation details.

    What is the difference beteen ABSTRACT CLASS INTERFACE?
    Just answer me when can a programmer use ABSTRACT CLASS when can he use INTERFACE.

    i need the situation not the theory,that are available in all java books.

    keep smiling...
    Deb

    DB:3.48:Abstract Class Vs Interface ak

    Interfaces are used to allow a class to have multiple personalities. A class can implement any number of interfaces and this will allow it to be any of those types of objects. (It's almost like multiple inheratence)

    An abstract class has to be extended and you can only extend one abstract class.

    An abstract class defines a general idea of what the object is. You extend it to fill in the details.

    An interface provides a framework for expected behaviour you provide the details of that behaviour.

  • RELEVANCY SCORE 3.48

    DB:3.48:Constructor For Abstract Class 7c


    can any body tell me,
    if we cannot instantiate an abstract class, then why there is a need of constructor for abstract class.
    one more thing is that an interface not have an internal state, but abstract class can have, so any relation here for solution of my problem? explain me how?

  • RELEVANCY SCORE 3.47

    DB:3.47:About Interface In Java 7z


    what is basic idea behind the interface and abstract class

    DB:3.47:About Interface In Java 7z

    Search in this forum. You will find lot of threads discussing the same topic.

  • RELEVANCY SCORE 3.47

    DB:3.47:Why Interface?Differnce Between Interface And Abstract Class d3


    why we go for interface? what is the difference between interface and abstract class?

    can anyone plz explain with clear picture.

    DB:3.47:Why Interface?Differnce Between Interface And Abstract Class d3

    Look at his profile. He's nothing but a homework dumper anyway. Someone to be ignored.

  • RELEVANCY SCORE 3.46

    DB:3.46:Abstract And Interface fa


    Dear Sir/Madam,

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

    DB:3.46: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 3.45

    DB:3.45: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.45: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.45

    DB:3.45:Re: Abstract Class-Interface kk


    why abstract class is faster than interface?

    Because mauve has the most RAM.

    ~

    DB:3.45:Re: Abstract Class-Interface kk

    Do you know any documentation about this of Sun's current JVM?No, sorry. If there are docs about this, [http://research.sun.com/techrep/] is probably a start. I believe that the Self Project [http://research.sun.com/self/] was also pretty influential and has some papers available.

    If you need a definite answer on how it is implemented in the current JVM and are fluent in C, you could take a look at HotSpot's source code. I browsed a bit (out of curiosity) and admittedly it's, well, complex (surprise! ;-) -- but given some time (and interest, of course) I guess one should be able to at least get an idea of how it works (fortunately there are some comments, too). I used OpenGrok here [http://opengrok.neojava.org/hotspot], and found some entry points for further investigation; maybe they're helpful:

    [http://12.101.252.19/hotspot/xref/src/share/vm/interpreter/cInterpretMethod.hpp], search for "CASE(_invokeinterface)"
    [http://12.101.252.19/hotspot/xref/src/share/vm/runtime/javaCalls.cpp#call_virtual]
    [http://12.101.252.19/hotspot/xref/src/share/vm/opto/doCall.cpp#do_call]

    [http://12.101.252.19/hotspot/xref/src/share/vm/oops/klassVtable.hpp]
    [http://12.101.252.19/hotspot/xref/src/share/vm/oops/klassVtable.cpp], "miranda methods"

    [http://12.101.252.19/hotspot/xref/src/share/vm/interpreter/linkResolver.cpp] (?)

    Or just try your luck in the HotSpot Internals forum...

  • RELEVANCY SCORE 3.45

    DB:3.45: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:3.45: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 3.45

    DB:3.45:Re: Why An Interface Is Used In A Java Program pc


    These are fair comments as per as interface is concern.... we need interface to declare the methods without implementing the methods. Basically interfaces help implementing classes in a organised way.
    Now We got abstract class also, which has got more or less same features like interfaces. In abstract class also we can declare a method without implementation.
    If we use abstract class and extend that abstract class, we don't have implement all the abstract methods in that particular class,which would extend the abstract class, but if we implement an interface in a class, we have to define all the methods with their body. Now, can anyone tell me , in a generic way, when do we use interface and when do we use abstract class. I don't need the differences between abstract class and interface...that i know...thanks in advance
    take it easy
    RD
    l

    DB:3.45:Re: Why An Interface Is Used In A Java Program pc

    For Ex: 5 years down the line, .........I always wondered why it is said "down the
    line" and not up the line.
    What's so downish about the future ?People degrade as the years pass by. :P

  • RELEVANCY SCORE 3.45

    DB:3.45:Doubt About Interface &Amp; Abstract xa


    Hai everybody,
    I am new java technology. I need clear discribtion about interface abstract.
    Please give some examples and differentiate it.

    i awaiting for your reply

    by
    azhar

    DB:3.45:Doubt About Interface &Amp; Abstract xa

    Even Wikipedia has info about this:

    http://en.wikipedia.org/wiki/Interface_%28Java%29
    http://en.wikipedia.org/wiki/Class_%28computer_science
    %29#Abstract_and_concrete_classeswhenever someone asks this question, they don't really want to read about it, they just want someone to tell them the secret rules about when to use an interface and when to use an abstract class. but we're not telling :-)

  • RELEVANCY SCORE 3.45

    DB:3.45: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.45: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.45

    DB:3.45:Simple Query ac


    Difference between Abstract class and interface with practical example

    DB:3.45:Simple Query ac

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

  • RELEVANCY SCORE 3.45

    DB:3.45: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.45

    DB:3.45:Abstract Calss Vs Interface af


    hi all,

    what are the pros and cons of abstract calss and interface?
    when to use abstract class and when to use interface???

    thanks.

    DB:3.45:Abstract Calss Vs Interface af

    Well.. this is very basic question and asked many times. Googling this question may give you good results...

  • RELEVANCY SCORE 3.45

    DB:3.45:When To Use Abstract Class And Interface? jp


    hi,

    When to use Abstract class and Interface?

    DB:3.45:When To Use Abstract Class And Interface? jp

    Thanks for all, i got some clear idea about when to use interface and abstract class.

  • RELEVANCY SCORE 3.45

    DB:3.45:Difference ???? xz


    What's the difference between an Interface and Abstract class ??????

    DB:3.45:Difference ???? xz

    Is google broken again?
    [http://www.google.co.uk/search?q=What's+the+difference+between+an+Interface+and+Abstract+class] 652,000 hits

  • RELEVANCY SCORE 3.45

    DB:3.45:Interface And Abstract Class dc


    why we have constructor for abstract class and not for interface,

    DB:3.45:Interface And Abstract Class dc

    Simpler reason: interfaces have no implementation. Period.

  • RELEVANCY SCORE 3.44

    DB:3.44:Interface And Abstract Class ad


    Why can't we declare a static method in Interface but it's possible in abstract class?

    DB:3.44:Interface And Abstract Class ad

    Because an interface is simpler than an abstract class.
    Normally you would put a static method like this into a utility class with a private constructor. see the Math class.