• RELEVANCY SCORE 5.35

    DB:5.35:Public Abstract Interface Filterconfig pf




    public abstract interface FilterConfig

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

    DB:5.35: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 5.03

    DB:5.03:Abstract Class 13




    Difference between abstract class and interface
    use of abstract class

    DB:5.03: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 4.92

    DB:4.92: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:4.92: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 4.83

    DB:4.83:Development Scenario For Abstract Class And Interface In .Net ? kf


    Hi,
    In which real time Development scenario we should use abstract class or interface ???Rupesh

    DB:4.83:Development Scenario For Abstract Class And Interface In .Net ? kf

    how to transfer data in multiple Update Panel using asp.net and C#.net ?

    I have 2 update panels. Grid view is there in one update panel upd1. and text box is there in another update panel. when the link button Edit is clicked in the grid view the data need 2 come to the text box for editing.

    Rupesh

    You have to ask this last question in the ASP.NET Forums at the following address
    http://forums.asp.net/37.aspx/1?C
    Bye.Luigi Bruno - Microsoft Community Contributor 2011 Award

  • RELEVANCY SCORE 4.76

    DB:4.76:Re: Public Abstract Static... In Abstract Class? 39


    And have you ever heard about instanceof or getClass()?

    DB:4.76:Re: Public Abstract Static... In Abstract Class? 39

    I second rene's opinion that the design stinks. If you need to do something like this, then generally it means you are trying to do something outside the Ping or Pong class that should be done inside the class. For example:
    if (packet.getPacketType() == Packet.PING)
    doSomething();
    else if (packet.getPacketType() == Packet.PONG)
    doSomethingElse(); Should probably be handled like:
    public abstract class Pacaket {
    public abstract void doThing();
    }
    public class Ping extends Packet {
    public void doThing() { doSomething(); }
    public void soSomeThing() { ... }
    }
    public class Pong extends Packet {
    public void doThing() { doSomethingElse(); }
    public void doSomethingElse() { ... }
    }

    //...
    packet.doThing();

  • RELEVANCY SCORE 4.70

    DB:4.70:When Should I Use Abstract Classes And When Should I Use Interfaces? da


    Can any body tell me in which scenario we use /we go for Interface and which scenario we go for abstract class, because as per my knowledge what ever thing we can do by using Interface that thing can also done through abstract class i mean to say that the
    behavior of the two class.
    And other thing i also want to know that which concept comes first into the programming abstract class or Interface.

    S.K Nayak

    DB:4.70:When Should I Use Abstract Classes And When Should I Use Interfaces? da

    excellent explanation
    Although one difference between abstract classes and interfaces doesn't seem to have been explicitly stated (I think it is implied in a couple of posts). That is a class can implement several interfaces, but it can only inherit from one class (abstract or otherwise).
    So interfaces are useful for related types of behavoiur that are expected to be only subset of the behaviour of the implementing classes.

  • RELEVANCY SCORE 4.53

    DB:4.53:Abstract And Interface fa


    Dear Sir/Madam,

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

    DB:4.53: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.50

    DB:4.50:Interfaces And Abstract Classes 8x


    Whats the difference between an interface and an abstract class.

    DB:4.50: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 4.45

    DB:4.45:Abstract Class That Implements Comparable px


    I am trying to understand how a comparable interface works with an abstract class. Any help is greatly appreciated.

    I have a class ClassA defined as follows:
    public abstract class ClassA implements Comparable I have a method, compareTo(..), within ClassA as follows:
    public int compareTo(Object o) I have a sub-class ClassB defined as follows:
    public class ClassB extends ClassAI am receiving a compile error:
    Class must implement the inherited abstract method packagename.ClassA.compareTo(Object)

    Should or can the compareTo be abstract in ClassA and executed in ClassB? Just not sure how this works.

  • RELEVANCY SCORE 4.38

    DB:4.38:Interfaces And Abstract Classes ck


    Hello,

    I am confused between an Interface and an abstract class. I would cite an example:

    I consider various shape objects esp. square, rectangle etc. and consider a common behavior area which I need to determine for each of these shapes. Should I consider an Interface or an abstract class and why?

    DB:4.38:Interfaces And Abstract Classes ck

    Hint: Interfaces say what objects must do; abstract classes say (partially) how to do them (i.e., it can provide implementations).

    Two shapes are circles and squares.

    To what extent do you think you'll reuse an area() calculation between them?

  • RELEVANCY SCORE 4.38

    DB:4.38:In Which Case We Need A Class With All Methods Defined As Abstract ? 1d


    In which case we need : A class with all methods defined as abstract (or should we go for Interface always in this case)

    DB:4.38:In Which Case We Need A Class With All Methods Defined As Abstract ? 1d

    The concept of interface and abstract class overlaps sometime, but we can have the following thumb rule to use them for our specific need:

    1) Interface: This should be use for code structuring. They standardize your application by providing a specific contract within and outside. If you think abstract class also provide structure, then reconsider as it limits the structure re-usability when there are many super-classes to inherit from. Java allow multiple inheritance by interface and not by Abstract class.

    2) Abstract Class: This should be use for code-reusability. Interface doesn't have any code so can't be used for code-reusability.

    Actually we can use both to provide the best.Taking a refernce to J2EE framework, the "Servlet" is an interface. It laids down the contract/structure for any code to be a servlet.

    But the "GenericServlet" class is an abstract class which provides implementation of some of the methods defined in the "Servlet" interface and leave some method abstract.

    Thus we see that the "Servlet" interface standardise the structure and the "GenericServlet" abstract class gives code re-usability.

    Original Question:
    In which case we need a class with all methods defined as abstract ?To this question, as all methods are abstarct we don't have option for code-reusability. so why not add standard structure concept to your application. So if there is not any restriction on making the field variable(if any) as final, we should go with the interface concept.

  • RELEVANCY SCORE 4.38

    DB:4.38:How To Use Abstract Class Using Reflection 37


    I have a set of code. "MyTestCase" is a class that extends an abstract class and is implementing the abstract function of that class. I am trying to call the class "MyTestCase" using the below code, but it throws InstantiationException, which says that MyTestCase might be an interface or an abstract class. But it is not an abstract class. Can anyone help me in this...

    public void createSuite()
    {
    try
    {

    Class file = Class.forName("test.barco.testframe.MyTestCase");
    Object fileObject = file.newInstance();

    }
    catch(ClassNotFoundException e)
    {System.out.println("ClassNotFoundException");}
    catch(IllegalAccessException e)
    {System.out.println("IllegalAccessException");}
    catch(InstantiationException e)
    {System.out.println("InstantiationException");}
    }

    DB:4.38:How To Use Abstract Class Using Reflection 37


    Can you post the actual error message you get?

    And how about the declaration line of MyTestCase?

  • RELEVANCY SCORE 4.38

    DB:4.38:Abstract And Interface? cm


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

    DB:4.38:Abstract And Interface? cm

    Oh please, do some research of your own.

  • RELEVANCY SCORE 4.38

    DB:4.38:C#: What Is Difference Between Abstract Class And Interface? How To Decide To Use Which One? 18


    I have been asked a question: how to decide to use Abstract class or Interface?
    We know that the Interface is special Abstract. All definitationsare default public and without implemetion. Classed inherit from interface has to implement all definitions.

    Abstract class does not need to implement all the methods and it can not be instantiated.
    Classes inheritfrom abstract classmay sharecommon logic (properties or methods) with abstract class and also override some methods' behavior.
    How to clearily answer this question? Thx!

    JaneC

    DB:4.38:C#: What Is Difference Between Abstract Class And Interface? How To Decide To Use Which One? 18

    Hello JJChen,
    Interface class can be implement in small units of data but abstraction class can be implemented in large units of data.
    1. Here is explanation of
    Interface class
    2. Here is explained
    Abstraction class.
    3.
    Difference betweenAbstraction andInterface class.
    Hope it will help you a lot.
    thanks,

  • RELEVANCY SCORE 4.35

    DB:4.35:When Should We Use What?(Class, Abstract Class, Interface)... 1a


    I have the ideas about Class, Inferface, Abstract Classes..

    My question is in what situataions we should use these? I mean what can I do with Interface which I cannot do with simple class or what can I do with Abstract class which I cannot do with inteface or class?? How am I supposed to know which one I should use??

    Could anyone plz plz answer these questions

    I am really really CONFUSED!!!!!

    Thank you

    DB:4.35:When Should We Use What?(Class, Abstract Class, Interface)... 1a

    To add to CRicky's post...

    The advantage that an abstract class has over an interface is that you can provide some implementation to some of the code. You can also have some non-public methods, some instance variables, etc.

    The advantage of interfaces is that they can extend more than one other interface and they classes can implement more than one interface.

  • RELEVANCY SCORE 4.34

    DB:4.34: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.34

    DB:4.34: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:4.34: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 4.28

    DB:4.28:Re: Meaning Of Extends And Implements mk


    simple.
    you implements an interface.
    and you extends a class or abstract class.

    one exception:
    an interface extends another interface (not implements it).

    DB:4.28:Re: Meaning Of Extends And Implements mk

    First of all: it's rather confusing to have a thread start out about some general questions about extending vs. implementing, and then let it morph into something completely different, like how to put checkboxes in a tree. When you have a completely different question like that, it's better to start a new thread.

    Second of all: for future reference Swing questions are preferrably posted on the Swing forum.

    Third of all: yes, you need to use a cell editor if you want to put a checkbox in your tree node. You can read more about it here:

    "Concepts: Editors and Renderers":
    http://java.sun.com/docs/books/tutorial/uiswing/components/table.html#editrender

    (The link deals with cell editors in JTables, but it's basically the same thing as for trees).

    You should probably also read this: "How to Use Trees":

    http://java.sun.com/docs/books/tutorial/uiswing/components/tree.html

  • RELEVANCY SCORE 4.28

    DB:4.28:Interface And Abstract Class ad


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

    DB:4.28: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.

  • RELEVANCY SCORE 4.28

    DB:4.28:How To Find Out If A Class Is Abstract? 3a


    Hi,

    I'm loading some classes via ClassLoader. Some of them could be interfaces or abstract classes. I'm only interested in classes which I can instantiate. With myClass.isInterface() I can check if the class is an interface, but how can I find out if it is an abstract class? I'm missing the method Class.isAbstract().

    Frank

  • RELEVANCY SCORE 4.26

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

    DB:4.26: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:4.26: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 4.25

    DB:4.25:When Should I Use Abstract Class And When I Should I Interfaces x8


    when should we use abstract classes over interface or vice versa;i am getting this question regulary;how should i give proper answer.

    whatever methods we define in abstract class same thing we can do in interfaces;

    so what we can achieve with abstract class;

    with regds
    chaitanya

    DB:4.25:When Should I Use Abstract Class And When I Should I Interfaces x8

    You can implement multiple interfaces. You can only inherit from one abstract class.

    Abstract classes can implement some methods (and define others abstract).

    Abstract classes can have fields that get inherited, interfaces can't.

  • RELEVANCY SCORE 4.25

    DB:4.25: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.25: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.25

    DB:4.25: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 4.24

    DB:4.24: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:4.24:Interface And Abstract Class ac

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

  • RELEVANCY SCORE 4.23

    DB:4.23:Can Interface Extend Abstract Class? k3


    Can interface extend abstract class?

    I tried to make a interface extend an abstract class but i got an error stating:
    interface expected here.

    Can anyone help me ?

    DB:4.23:Can Interface Extend Abstract Class? k3

    ok, but can an interface implement an abstract class?

    No. An interface provides no implementation whatsoever. An abstract class can implement an interface, but not the other way around.

    http://java.sun.com/docs/books/tutorial/java/concepts/interface.html

    ~

  • RELEVANCY SCORE 4.20

    DB:4.20:Help With Interfaces / Abstract Classes Please cp


    Hi all, I was wondering if I was able to get an interface or an abstract class to force the class that interfaces it to create an instance of something? For instance:
    public class A : IMyInterface
    {
    }

    public class B
    {
    }

    public interface IMyInterface
    {
    //I want hear to force any class that interfaces me to create an
    //instance of class B.
    }
    Can I do this? Would I need to use an abstract class to do this as an Interface can't have implementation... Thanks, Onam.

    DB:4.20:Help With Interfaces / Abstract Classes Please cp

    You can't force the class to create an instance of something in an interface, but you can force the interface to implement a property, ie: public interface IMyInterface {     public B MyBInstance     {         get;     } } public class A : IMyInterface {     // A now needs to provide a property that will return a B, or the compiler will complain } You can do the same thing with an abstract base class.  The difference here is that you can put the logic of creating and returning the B property directly into the base class, so it's not duplicated in every class that implements it. However, I would recommend thinking about this slightly differently - If A (and all other types implementing MyInterface) is-a type of MyInterface, then I would make MyInterface an abstract class. If A acts-as or acts-like or can perform as a MyInterface, then I would make MyInterface an interface. Reed Copsey, Jr. - http://reedcopsey.com

  • RELEVANCY SCORE 4.18

    DB:4.18: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.18: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.17

    DB:4.17: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:4.17: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 4.15

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

    DB:4.15:Abstract Class And Interface z1


    What is most important thing about abstract class and interface.

    When to use abstract class and interface.

    DB:4.15: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 4.13

    DB:4.13:Help With Interface And Abstract cs


    Hi all

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

  • RELEVANCY SCORE 4.11

    DB:4.11:When We Are Going For Abstract Class Or Interface mp


    Hi,
    I what situation we are going for abstract class or interface.anybody explain me with example waht are the conditions we decided wether it is abstract class or interface

    Thanks a lot
    Rajeev.a

    DB:4.11:When We Are Going For Abstract Class Or Interface mp

    Use an interface when you want to just define a type without providing implementation, or when you might want it to be multiply inherited.

    Use an abstract class when these conditions don't apply.

    For more details, google for something like java abstract class vs. interface.

  • RELEVANCY SCORE 4.10

    DB:4.10: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:4.10:Make Abstract Class With Interface. 39

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

  • RELEVANCY SCORE 4.10

    DB:4.10:Re: Oo Design Decision - Interface, Subclass Or Override d8


    just musing,

    abstract class Animal;
    abstract class Plant;
    class Cat extends Animal;
    class Dog extends Animal implements Tradable;
    class Wheat extends Plant implements Tradable;

    interface Tradable {
    public Object buy( Object obj );
    public Object sell( Object obj );
    }

    abstract class TradingSystem;
    class FreeMarket extends TradingSystem;
    class Barter extends TradingSystem;

    have not thought any further! :)

    DB:4.10:Re: Oo Design Decision - Interface, Subclass Or Override d8

    yes, but then for us, it is just for fun. it might not be for you :)

    d) Buy a book on patterns and read it before posting stupid questions on this forum I guess you have to
    have a really clear picture of what you want to have
    happen before you dive into a problem.

  • RELEVANCY SCORE 4.08

    DB:4.08: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:4.08:Dificult To Understand Interface And Abstract Class 98

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

  • RELEVANCY SCORE 4.07

    DB:4.07:Difference j9


    difference between abstract class and interface

    DB:4.07: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.07

    DB:4.07:Re: Abstract Class-Interface kk


    why abstract class is faster than interface?

    Because mauve has the most RAM.

    ~

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

    DB:4.07:Interface And Abstract Class dc


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

    DB:4.07:Interface And Abstract Class dc

    Simpler reason: interfaces have no implementation. Period.

  • RELEVANCY SCORE 4.06

    DB:4.06:Simple Query ac


    Difference between Abstract class and interface with practical example

    DB:4.06:Simple Query ac

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

  • RELEVANCY SCORE 4.06

    DB:4.06:Plz Clarify.. m7


    1) If i declared a class as final class..all the methods and variables also default final in this class?

    2) Which one is faster abstract or interface why?

  • RELEVANCY SCORE 4.05

    DB:4.05: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.05: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.03

    DB:4.03:Interface Vs Abstract Class d8


    when do we need interface and when abstract class?

    DB:4.03:Interface Vs Abstract Class d8

    2.All the abstract methods must be overrided and
    implemented by the child class.by definition, you can't override a method that has no implementation

    3.Real Examples:

    when we implement the ActionListener interface for
    Button click event then we have to override the
    actionPerformed method, we dont have any other
    chices, so it is a way of forcing the inherited class
    to override certain methods.as before, we implement an abstract method. you're not forcing an override, this can't be done, nor would it be a good idea. as discussed at length recently :-)

    n java you can see all the classes that starts with
    Abstract is abstract.not so. there's nothing at all to stop you writing a concrete class named AbstractClass

  • RELEVANCY SCORE 4.03

    DB:4.03:Instanceof Operator Question sx


    Can you use instance of (successfully) on interfaces and abstract classes?
    I am confused because if class A implements interface B (or extends abstract class B) it is a type of B but it is not an instance of B, since interfaces/abstract classes cannot be instantiated.

    DB:4.03:Instanceof Operator Question sx

    Sorry, the reason I ask is because on weekdays I have limited internet time so if I ask it here I can work on my projects and get the answer without taking time away from working on my project. Thanks for the answers.

  • RELEVANCY SCORE 4.03

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

    DB:4.03:Abstract Class Cannot Be Override From An Interface Class sd


    Please help:(
    how to make an existing class to be abstract, so that it can override from an interface class?

    DB:4.03:Abstract Class Cannot Be Override From An Interface Class sd

    In my previous post, I implemented the isLargerThan(Relatable other) method as an example*.
    After a few searches, I've finally found out what you need : [*Implementing an Interface*|http://v1.dione.zcu.cz/java/docs/tutorial/java/IandI/usinginterface.html] .
    You don't have to include the lines of my example to the lines of the tutorial example.

    Edit : My sight is a real problem. I didn't notice you posted the tutorial example.

    Edited by: Chicon on Sep 20, 2009 10:21 AM

  • RELEVANCY SCORE 4.03

    DB:4.03:Abstract Class Or Interface ? 11


    can any one tell me the difference between an abstract class an an interface. which is more useful ?

    DB:4.03:Abstract Class Or Interface ? 11

    You could also try searching this site for your question. It has been discussed in other threads as well (I posted a simialar (how do you spell that?) question).

  • RELEVANCY SCORE 4.03

    DB:4.03:Abstract Or Interface 8s


    Hi all

    Actually I have one sinario in my module, Since 2-3 weeks I am unable to decide whether to use abstract class or interface there. I am only the person in my module , can anyone tell me the exactly where we need to use each of them and why. Please by

    Thks
    Sarma. Y

    DB:4.03:Abstract Or Interface 8s

    In the simplest words I can put, use an interface when you know the model and want to define a contract for other developers to adhere to. Use an abstract class when you have some functionality which would not change and make other methods can have different implementations abstract.

    http://www.javaworld.com/javaworld/javaqa/2001-04/03-qa-0420-abstract.html
    http://www.javaworld.com/javaworld/javaqa/2001-08/03-qa-0831-interface.html
    http://forum.java.sun.com/thread.jspa?threadID=582104
    ...

  • RELEVANCY SCORE 4.03

    DB:4.03:Override Abstract Method Error With Extensions fk


    Hi everyone,
    I'm trying to work with a Tree and use some of the visitor pattern. However, I get an "is not abstract and does not override abstract method" error, which I'm not so sure about. There seems to have been some discussion about related problems and bugs, but perhaps not in this context. Maybe I overlooked something, maybe the spec says something I missed, or maybe it's a bug. Any insights would be appreciated. Below is an example, which isn't too complex. I'm using inner classes as an alternative, but the same should be possible with packages.

    public class MyTree {

    public abstract class A {
    public abstract Object visit(Visitor v);
    }

    public abstract class B extends A {
    //...
    }

    public class C extends B {
    public Object visit(Visitor v) {
    return v.visitC();
    }
    }

    public interface Visitor {
    public abstract Object visitC();
    }

    }

    public class ExtendedMyTree extends MyTree {

    public abstract class C extends MyTree.B {
    //...
    }

    public class D extends C {
    public Object visit(Visitor v) {
    return v.visitD();
    }
    }

    public interface Visitor extends MyTree.Visitor {
    public abstract Object visitD();
    }

    }

    ExtendedMyTree.java:7: ExtendedMyTree.D is not abstract and does not override abstract method visit(MyTree.Visitor) in MyTree.A
    public class D extends C {
    ^

    DB:4.03:Override Abstract Method Error With Extensions fk

    kris_java wrote:
    same method using in both abstract and interface which method will access by subclass ?Ok, we get it. You signed up simply in order to resurrect old threads. Well done. Joke over

  • RELEVANCY SCORE 4.03

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

    DB:4.03:Abstact Class Or Interface d3


    why would one use an abstract class versus an interface?

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

    DB:4.03: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.03:Abstract Class z3


    Thanks Matthew .

    Thanks Regards

    Priya

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

  • RELEVANCY SCORE 4.03

    DB:4.03:Interface Or Abstract zx


    hi

    i have a question, how to find when to use interface or abstract class?
    regards Vimal

    DB:4.03:Interface Or Abstract zx

    Hi,
    It's not uncommon to use both. The interface declares the contractual behaviour while an absract class that implements the interface defines some default behaviour for a common instance of the behaviour. Take the example above of an interface with the accelerate
    method.
    interface IAccelateable
    {
    void Accelerate();
    }
    Then if the application is dealing with vehicles then an abstract class like this ...
    abstract class Vehicle : IAccelateable
    {
    public void Accelerate()
    {
    // speed up the vehicle
    }
    }
    and then you can provide a specific class type like this ...
    class Car : Vehicle
    { }

    Then you can have other classes that can use the behaviour through the interface.....
    public void Race(IAccelaterable thing)
    .... I might have some spelling mistakes here....

    Then you can create other types of things that aren't vehicles but can still accelerate. Like a Shark
    class Shark : IAccelateable
    {
    public void Accelerate()
    {
    throw new NotImplementedException();
    }
    }
    and the code doesn't need to change much

    The programmer, like the poet, works only slightly removed from pure thought-stuff. He builds his castles in the air, from air, creating by exertion of the imagination. - Fred Brooks

  • RELEVANCY SCORE 4.03

    DB:4.03:Design Aspacts When Should Use Abstract Class And Interface a1


    Hi, Any one can provide some real world example which can help me out when should use abstract class or interface because i have to design an small application so i want to know which would be the best option either abstract or interface . please provide some real world example so i can understand easily. thanks John

    DB:4.03:Design Aspacts When Should Use Abstract Class And Interface a1

    Good books on OOP will do wonders.  The GOF Design Patterns book actually helped me understand OO concepts much more thoroughly. In the .NET world, the Design Guidelines book is actually an absolute jewel - it talks about how to design your libraries to be effectively used, and in the process, really explains the why behind many of the decisions in the .NET framework.  You'd definitely fine-tune your thinking about OO (for example, this discussion of abstract class vs interface is discussed in detail). Reed Copsey, Jr. - http://reedcopsey.com

  • RELEVANCY SCORE 4.03

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

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


    Hi friends,

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

  • RELEVANCY SCORE 4.03

    DB:4.03:A Little Confuse About Interface/Abstract Class cp


    Hi,

    We know interface/abstract class define some abstract methods, so they cannot be instanced. But we can create a object of the interface. there is an example:

    public interface SomeInterface {........}
    SomeInterface mySomeInterface;

    Why can we create mySomeInterface? Or it is not instanced because it is not initialized? If we can understand it this way: an object is not an instance withou initializing. Is that correct?

    Thanks a lot.

    Scoit

  • RELEVANCY SCORE 4.01

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

    DB:3.99:Abstract Class Vs Interface ? 9d


    hi all,

    can anybody help me.

    if i have an abstract class (full of abstract method definitions) and an interface(having same definitions).

    Now the question is in which situation we go for an ABSTRACT CLASS with full of abstract method definitions and in which situation we go for an INTERFACE.

    and other differences between ABSTRACT CLASSES and INTERFACES except Multiple Inheritence ?

    DB:3.99:Abstract Class Vs Interface ? 9d

    Hi,
    All the variable inside the interface are static and final(You can't change it).While in case of abstract class it is not so. And in abstract class you can have concrete method also while in interface all the method must be non concrete So its depends on your requirement.

    Regards,
    Alok

  • RELEVANCY SCORE 3.98

    DB:3.98:How To Know When To Use Interface/Abstract Class dm


    Hi All

    Can someone please tell me the design time usage of Interface / Abstract class.

    DB:3.98:How To Know When To Use Interface/Abstract Class dm

    The best answer for this question I heard so far was: A class represents what an object IS and an interface what it CAN DO.

  • RELEVANCY SCORE 3.98

    DB:3.98: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 3.97

    DB:3.97: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.97: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.97

    DB:3.97: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.97: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.96

    DB:3.96:What Is The Purpose Of Interface Why Not Class Instead sf


    what is the advantage of interface or abstract class, why caan't we have simple class to get hte same functionality specially abstract classes, i don't get them

    DB:3.96:What Is The Purpose Of Interface Why Not Class Instead sf

    Java language does not have multi-inheritence of classes, which could have severely limited its functionality. Interface is a good complement for it, which provides the most important functionality a multi-inheritence can provide. If you understand the use of multi-inheritence of abstract class in C++, it should be difficult understand this.

    From Sun Java Language Specification:
    ******************************************************************************************
    Programs can use interfaces to make it unnecessary for related classes to share
    a common abstract superclass or to add methods to Object.
    ...
    A class may be declared to directly implement one or more interfaces, mean-ing
    that any instance of the class implements all the abstract methods specified by
    the interface or interfaces. A class necessarily implements all the interfaces that its
    direct superclasses and direct superinterfaces do. This (multiple) interface inherit-ance
    allows objects to support (multiple) common behaviors without sharing any
    implementation.
    ****************************************************************************************

  • RELEVANCY SCORE 3.94

    DB:3.94: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.93

    DB:3.93: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.93: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.92

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


    What is the scenario to use abstract class and interface

    DB:3.92: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.91

    DB:3.91:1.6 Language Change(S) (Or (Unnecessary) Bug Fix?) 93


    Hi

    Is this rather "Programming" or "JDK"?

    Something changed for 1.6? That this compiles without problem on 1.5

    public class Test {

    private abstract interface X {
    static abstract class Y {
    private abstract class Z {}
    }
    }

    private static abstract class A {
    private static class B extends Test.X.Y {
    private class C extends Test.X.Y.Z {}
    }
    }

    /** Creates a new instance of Test */
    public Test() {
    }

    /**
    * @param args the command line arguments
    */
    public static void main(String[] args) {
    // TODO code application logic here
    }

    }but on 1.6:
    Test.java:24: an enclosing instance that contains Test.X.Y.Z is required
    private class C extends Test.X.Y.Z {}
    1 error

    DB:3.91:1.6 Language Change(S) (Or (Unnecessary) Bug Fix?) 93

    Oh well, I worked on my project that uses code like this today.

  • RELEVANCY SCORE 3.91

    DB:3.91: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.91: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.91

    DB:3.91:Basic Java Mcq! d7


    I came accros a scjp quesion that is

    Which of the following are legal declerations for non nested classes and interfaces?
    A) final abstract class Test{}
    B) public static interface Test{}
    C) final public class Test{}
    D) protected abstract class Test{}
    E) protected interface Test{}
    F) abstract public class Test{}

    I think B,C,D,E,F are correct.I know that first one is wrong because final and abstract can not be used at the same time.Am i right or wrong?Can any one give me a explanation if i am wrong.

    DB:3.91:Basic Java Mcq! d7

    Also, a good site to see...

    http://www.uni-bonn.de/~manfear/javamodifiers.php

    Regards,
    Sidath.

  • RELEVANCY SCORE 3.90

    DB:3.90:Use Of Abstract And Interface? k3


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

    DB:3.90: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.90

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

    DB:3.90: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.90:Why We Use Interface? c9

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

  • RELEVANCY SCORE 3.90

    DB:3.90:Interface Abstract Class jc


    Hello,

    DB:3.90:Interface Abstract Class jc

    The example sited, as many, could be done with an abstract Account class, or with an Account interface. Given only the information in what you copied, An interface is resonable.

  • RELEVANCY SCORE 3.90

    DB:3.90: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.90: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.90

    DB:3.90:Generated Class Extending A Generic Class ac



    Is it possible to generate a (non-generic) class through Javassist that extends an abstract, generic class or interface? How can this be achieved?

    DB:3.90:Generated Class Extending A Generic Class ac


    If you're using proxies:
    proxyFactory.setSuperclass(cls);

  • RELEVANCY SCORE 3.90

    DB:3.90:Jsf Annotations On Interface Or Abstract Class xa


    Hello,

    Can we use JSF 2 annotations like @ManagedBeans or @SessionScoped for interfaces and abstract classes? I mean, will it works if I implement an interface which declares some annotation(s) and the managed bean class itself doesn't have annotations?

    Thanks a lot!
    Oleg.

    DB:3.90:Jsf Annotations On Interface Or Abstract Class xa

    Okey, an example:

    @ManagedBean
    public abstract class MyAbstractClass {
    ....
    }

    public class MyClass extends MyAbstractClass {
    ....
    }

    Does it work if I access MyClass by ValueExpression #{myAbstractClass} ? Will be MyClass automatically annotated with @ManagedBean?

    Best regards.
    Oleg.

  • RELEVANCY SCORE 3.89

    DB:3.89: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.89: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.89

    DB:3.89:Design Question a1


    I have design question.

    I have an interface
    Iabc with two methods: a() and b()
    An abstract class implements this interface with a() implemented,but
    b() declared as abstract method.
    Then i have 3 child classes extending abstract class
    Child1() : inhetis a(), implements b()
    Child2(): inherits a(), implements b()
    Child3(): inherits a(), implements b()

    But if Child1 and Child2 have another common method. then should i put this common method in the interface, implement in abstract class and have empty implementations for it in another child classes that do not need it??
    What are all the different ways of handling this situtation.
    Should i create a new interface or name the abstract class as a just a simple base class, or create a new abstract class...these are some of the question i have....
    Plesae let me know wat is a good implementation and y?

    thanks
    Ragini

    DB:3.89:Design Question a1

    I have design question.

    I have an interface
    Iabc with two methods: a() and b()
    An abstract class implements this interface with a() implemented,but
    b() declared as abstract method.
    Then i have 3 child classes extending abstract class
    Child1() : inhetis a(), implements b()
    Child2(): inherits a(), implements b()
    Child3(): inherits a(), implements b()

    But if Child1 and Child2 have another common method. then should i put this common method in the interface, implement in abstract class and have empty implementations for it in another child classes that do not need it??
    What are all the different ways of handling this situtation.
    Should i create a new interface or name the abstract class as a just a simple base class, or create a new abstract class...these are some of the question i have....
    Plesae let me know wat is a good implementation and y?

    thanks
    Ragini

  • RELEVANCY SCORE 3.88

    DB:3.88: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.88

    DB:3.88:Serializable Interface Or Abstract Class?? 19


    If we have to do custom serialization we have to implement

    private void writeObject(java.io.ObjectOutputStream out)
    throws IOException
    private void readObject(java.io.ObjectInputStream in)
    throws IOException, ClassNotFoundException

    Where is the default implementation of these methods? if it is Serializable interface then this interface should be an Abstract class not an interface! How the serialization done inside java? Please help. Thanx.

    DB:3.88:Serializable Interface Or Abstract Class?? 19

    the default implementations are ObjectOutputStream.defaultWriteObject() and ObjectInputStream.defaultReadObject(), per the API documentation.

  • RELEVANCY SCORE 3.87

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

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

  • RELEVANCY SCORE 3.86

    DB:3.86:Java Constants xz


    Hi all,
    Is normal class or abstract class or interface a good place for declaring constants?What is best practices for constants?

    Regards
    Ranjeet

    DB:3.86:Java Constants xz

    Just for the record. There's an item #17 dealing with this topic in Effective Java by Bloch.

  • RELEVANCY SCORE 3.85

    DB:3.85: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.85: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.83

    DB:3.83:How To Use Method In Both Abstract And Interface 3z


    Hi there ,
    I am at the moment trying to dealing with java media framework but have a problem using their function which is either abstract or Interface. does anyone know how to use method and how to run the abstract class? Also how to run the method in interface? I hope this is not too much to ask for all of you out there.

    many thanks
    sun

    DB:3.83:How To Use Method In Both Abstract And Interface 3z

    Abstract classes can't be used directly, nor they can be instantiated. They have to be first inherited and only, then, they can be instantiated, and methods can be used. Normally the abstract class just defines the method and the subclass provides the concrete implementation of the method.

    gk

  • RELEVANCY SCORE 3.82

    DB:3.82: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:3.82:Abstract Class And Interface 3j

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

  • RELEVANCY SCORE 3.81

    DB:3.81:Abstract Class-Interface - Usage 71


    hai
    Give me details regarding the suituation of using
    1. Abstract class
    2. Interface

    DB:3.81:Abstract Class-Interface - Usage 71

    Basically an interface is a set of methods a class can promise to implement. An interface often expresses some aspect of a class that isn't related to the class hierarchy itself (that Dog, Duck and Cat extends Animal kind of stuff). It's often a common way to access stored objects like for example the Enumeration and Iterator interfaces.

    If a class has promised to implement an interface but doesn't, it becomes abstract. A class also becomes abstract if some methods are declared abstract. In both cases the class must be declared abstract and the actual implementation of the abstract methods is left over to subclasses.

    The reason for declaring a method abstract is one of design. The abstract class is often made to contain general information about something, and its subclasses are expected to fill in specific details by implementing the abstract methods. For example Animal can leave noise() abstract and let Dog, Duck and Cat provide the actual sounds.

  • RELEVANCY SCORE 3.81

    DB:3.81: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.81: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.80

    DB:3.80:Interface Vrs Abstract Class ps


    why would i during design choose for an interface or an abstract class. I cant understand the need for both ?

    To make a class a partially implemented, its has to be abstract.
    I can choose to create a complete Interface heirarchy and simulate the same.........

    Can people clarify why Interface and why abstract.

    Ps: I know difference between both but I want to justify myself why I wud go for abstract class or interface

    Looking for ur inputs

    DB:3.80:Interface Vrs Abstract Class ps

    why would i during design choose for an interface or
    an abstract class.If there was no abstract you would have to use overriding to accomplish the same thing. But abstract is stronger because you clearly state your intention of leaving the implementation to a subclass. Overriding isn't enforced, the subclass always has a choise. In short, using abstract the superclass rules, using overriding the subclass rules.

    So the big deal is when to use abstract and when to use overriding. Interfaces don't have anything to do with that! Interface are used when you want to ensure a class has a certain functionality that is not a natural part of the normal class hierarchy. It's often a common way to access data, like for example iteration.

  • RELEVANCY SCORE 3.79

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

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

    DB:3.78:Exporting Interface From A Library sj


    I am new to C# and .NET. I am building a library which exports an interface or abstract class. My question is whats the proper way to export the interface implementation
    creator method?
    In C I would either create a global CreateInstance function or static one in the interface or abstract class itselfthat would actually create the interface implementation
    class an return the interface reference. Since in C# everything is in a header file how can I allow my library user to create the interface implementation instance without exposing the implementation class itself?

    DB:3.78:Exporting Interface From A Library sj


    Usually people make something like the following:

    Declare your interface as public Declare your class itself either as private or as internal so it's not seen on the outside of the DLL
    Declare a public Factory class with a static member which creates an instance of your class but returns only the interface

    What is left unsaid in #3 is that you cast the instance of the internal class to the public interface.
    Rudy =8^DMark the best replies as answers. Fooling computers since 1971.
    http://thesharpercoder.blogspot.com/

  • RELEVANCY SCORE 3.78

    DB:3.78:Abstract Classes m9


    can all classes inherit Abstract class....or is there any restriction that only one class can inherit abstract class

    DB:3.78:Abstract Classes m9

    An interface says what an object has to do.

    A class says how to do it. The class might be abstract, which means that it only says how to do some of it -- a subclass then has to say how to do the rest.

  • RELEVANCY SCORE 3.78

    DB:3.78: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.78: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.78

    DB:3.78:Abstract Class And Interface 18


    what is the difference between abstract class and interface

  • RELEVANCY SCORE 3.77

    DB:3.77:Abstract Class sj


    hello

    why cant we create an object to Abstract class and interface ?
    And if we cant create object how can we can create reference variables to both abstract and interface?

    DB:3.77:Abstract Class sj

    kirn291 wrote:
    how can we can create reference variables to both abstract and interface?I can create a variable of type List (interface), like so

    List _myList = new LinkedList();

  • RELEVANCY SCORE 3.77

    DB:3.77:Abstract Class &Amp; Interface jp


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

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

    DB:3.77:Interface Vs Abstract Class sa


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

    DB:3.77: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.77

    DB:3.77: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.77: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.76

    DB:3.76:Interface And Abstract Class c3


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

    DB:3.76:Interface And Abstract Class c3

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

    Double your pleasure or not!

  • RELEVANCY SCORE 3.76

    DB:3.76:Interface ck


    Can u Explain me the defintion for interface, abstract class

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