Top Answer
User Avatar
Wiki User
Answered 2010-02-12 14:03:21

Some differences are:

  • An abstract class can have code for one or more methods but an interface cannot
  • All variables in an interface are public static and final but in an abstract class it is not
  • Abstract classes are faster than interfaces
User Avatar

Your Answer

Still Have Questions?

Related Questions

What are the differences between an interface and an abstract class?

An interface is like a 100% abstract class. Only abstract methods can go in an interface. In addition, all methods in an abstract class are public and abstract by default. You "extend" an interface using the keyword implements. You can implement multiple interfaces, but you have to extend only one class. An interface can have only constants. This means no instance variables.As for an abstract class, you can put both abstract and concrete methods in an abstract class. It can have instance variables, but you can only extend one abstract class.Sun recommends using abstract and concrete class extension to signify what a class is, with an example in the following inheritance tree:Object||-Person||-Programmer||-JavaProgrammerAn interface is for signifying what jobs a class can do, like a Message class implementing a Sendable interface. Also, class names should be nouns and interface names should be adjectives, but conventions vary widely among programmers.

How is abstract class different from interface with example?

An abstract class has at least abstract methods. An interface has only abstract actions. For example, the javax.swing.AbstractAction class has only one abstract method that must be overriden: public void actionPerformed(ActionEvent e). The java.awt.event.ActionListener interface has the same method that must be overriden; however, it is its only method. The AbstractAction class is a subclass of the Action class, which implements the ActionListener interface. The AbstractAction class has overriden all but one of the Action class's methods.

What is the difference between data structure and abstract data type?

An Abstract Data Type is an interface that interacts with a data structure. A Data Structure is an implementation of the ADT. for example. If you were going to create a linked list you would create an Interface listing all the methods required by the list. Then in the linked list class you would code how the list uses these methods. Hope this helps :)

Can you create an object of abstract class and interface?

No, not directly. You cannot use new operator to create either. However, you may create an instance of derived class from the abstract class, and treat (by casting, for example) as an instance of the abstract class. Similar to an interface: create an object from a class that implements the target interface, then treat that object as an instance of that interface.

What part of speech is difference?

The word 'difference' is a noun, a common, singular, abstract noun. Example use: The difference between right and wrong is sometimes a choice between difficult and easy.

What is the difference between microprocessor and microcontroller?

The basic difference between the microprocessor and microcontroller is that we can interface a microcontroller directly means "for example we can directly connect a keyboard to microcontroller to any of its ports"....where as for microprocessor we can't interface directly...we require a circuit board since it requires ram,ic's.....etc.,! beyrojac mahinay

Real time example for interface vs abstract class in java?

w.frnds........ I am just trying to an example of abstract class and interface class in real life . As these two ["interface class" is not a term in Java programming - just "interface"] classes [sic] are a concept of objest orientation so easy we can easily compare thhese with our real life . Suppose we have an abstract class called clark and an abstract method behabour of this abstract class ,which has no definition in abstract class. two other class security and receptionist inherits these clark class. So in thses two derived class there must has to be a defonation of behabour method,which depends on the derived class which types of behabour they will show........ So that is a real life example of Abstract class .Interface is also same as abstract class only the difference is it can't contain any implementation of any method in base class or super class. I think this is a sufficient example to understand abstract class and interface. [No, it is not sufficient.] If u have any doubt then u can contact me with this email id-rkmahanta26@gmail.com [Interfaces support multiple inheritance; classes do not. Interfaces contain only public members; classes do not have to. Interfaces do not have superclasses, except the implicit 'Object' supertype; they have superinterfaces. Nested interfaces are always static, never inner, unlike classes which can be inner classes. "u" is not an English pronoun. Use the tutorial and the JLS to understand interfaces and abstract classes, not this garbage answer.]

Difference between cli and GUI based on os?

CLI is Command Line Interface GUI is Graphical User Interface CLI - You type commands into a prompt and the computer executes them. GUI - You use a graphical interface and make selections with the mouse and the computer executes them. CLI example: MS-DOS GUI example: MS Windows XP

Difference between a command-line interface and a graphical user interface?

A command line interface is made up completely of text. A graphical user interface (GUI) is used in conjunction with a pointer device to used icons in place of the text. For example, in compiling a java program, the Eclipse IDE uses a point and click interface, while a command line interface would be the javac command.

What is difference between abstract noun and compound noun?

Abstract nouns are intagible and at the same time it is just felt; where as compuond noun is made up up of more than one noun like for example: SOn-in-law

What is the difference between has and have and give an example?

the difference between has and have is that you use has in sentences with : ( she , he and it ) for example : she has a book . but you use have in sentences with : ( I , you , we and they ) for example : you have a book , I have a book .

What is the difference between a promina 800 and an ATM?

Promina 800's have the capability to interface to an ATM network but also can interface with many other divices for example symectric trunks up to 8Mbps IP Trunks up to 16Mbps and T-3 trunks

What is the difference between a Unix or Linux shell and X-Windows?

A "shell" can often refer to an "interface", in which case X-Windows is simply an example of an interface. In Unix and Linux, however, a "shell" is often used to refer to a command-line interface, such as bash or csh. The X Window system is system for displaying a graphical user interface (which in itself can vary significantly in appearance).

What is one example of a abstract noun?

An example of an abstract noun is knowledge.

What is the difference between a nuatral and a polictical boudary give a example of each?

what is the difference between a natural and a political boundary.Give a example of each.

What is runnable interface?

A Runnable Interface is one that is used to create a Java Thread... A Thread can be created in two ways and using the Runnable Interface is one of them. Example: public class Test implements Runnable { public void run(){ .... } } The Runnable interface would have an abstract instance of the method run() which needs to be implemented in the class which wants to create a Thread.

Difference between eg and ie?

example given......in example

Is the variable of x an example of abstract representation?

is the variable of x an example of abstract representation

What is the different between Abstract and a base class in java?

An abstract class(or classes) can't have a constructor and hence you cannot invoke the constructor of the class (for example, you can instantiate an abstract class and hence you cannot call the constructor of an abstract class).

How do you spell the word difference?

The correct spelling is difference.An example sentence is "there is a difference between the words their and there".

What is an abstract noun for wall?

There is no abstract noun form for the concrete noun 'wall', a word for a physical structure.The noun wall can be used in an abstract context, for example:His jealousy is becoming a wall between us.

Is example an abstract noun?

Yes, 'example' is an abstract noun; a word for a concept, not a physical thing.

What is the difference between a GUI and a CUI?

CUI stands for Character User Interface. it means that you have to type commands to interact with the computer. For example, in DOS for every thing we type the commands. GUI stands for Graphical User Interface. It means that you do not need to type commands to interact with the computer; instead you have to click with the help of a mouse on the icons of ready made commands. An example is Windows.

Is future an example of an abstract noun?

"Future" is an abstract noun. It names a time (intangible) that has yet to come.

Still have questions?

Trending Questions
Unanswered Questions
Where is 5.9055118 on a ruler? Asked By Wiki User