answersLogoWhite

0


Best Answer

The similarities are:

a. They are both java basic object types

b. They both can contain variables and methods (With difference being class methods have implementation code whereas the interface methods can only have declarations)

c. They can both be inherited using Inheritance (extends keyword for classes and implements keyword for interfaces)

User Avatar

Wiki User

13y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

14y ago

Classes and Interfaces are both Java files. They are saved as .java files with the name as the public class or public interface name.

The difference is that, classes are fully coded. That is, they have all the necessary variables and methods coded in them. But in case of Interfaces, only methods are declared. They are not defined. Interfaces are only like skeletons whereas classes can implement interfaces and complete the skeleton.

This answer is:
User Avatar

User Avatar

Wiki User

13y ago

The similarities are:

a. They can both be used for inheritance

b. They can both have methods (Of course interfaces can have only method declarations whereas classes can also have code inside methods)

c. They can both have variables (We can declare the access modifier class variables but for interfaces they are by default public, static and final)

d. A class can be instantiated but an interface cannot.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is similarities between interface and classes?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What are the similarities between windows 98 and NT?

There are very few similarities between Windows 98 and Windows NT, other than a similar interface.


What is difference in use between interfaces and abstract classes in java?

While neither abstract classes nor interfaces can be instantiated in Java, you can implement methods in abstract classes. Interfaces can only define methods; no code beyond a method header is allowed.


What are 2 similarities between mac and windows operating system?

They both primarily use a graphical user-interface (GUI). They are both developed by American companies.


What are the similarities between soldering and welding?

In soldering and welding, 2 or more pieces of metal are joined by melting metal at the interface between them. When the molten metal cools and hardens, it physically bonds the pieces together.


Why an interface can not have anything but constants and abstract methods?

The idea is that an interface is not a class, it is just a specification of what classes that implement it must contain.


Can you name the legacy classes and interface for collections?

Dictionary, Hashtable ,Properties ,Stack and vector are the legacy classes in java


What is the difference betwen class and interface?

classes can be extended and interfaces can be implemented.


In the field of computers what does the term java interface mean?

In Java, an interface is a suite of methods that multiple different classes are able to implement. Interfaces are not assigned to any particular class. For example, multiple graphics classes can use the same interface to change their size and colour.


What are the similarities between basketball and ring-ballwhat are the similarities between basketball and ring-ballwhat are the similarities between basketball and ring-ball?

what are the similarities between basketball and ring-ball


What is similarities between Abstract Class and Interface?

If a class has one abstract method ,the class has to be an abstract class.Methods can be implemented in abstract class.Whereas a interface is like a abstract class...the only difference being that the methods are never implemented in Interface.


What is 3 differences between software interface and command line interface?

Differentiate between Command line interface and Menus interface and example of each interaction style


What are similarities between plebeians and patricians?

At the beginning of the city they were different; the patricians were the rich, the plebeians were the poor. Once the plebeians gained their rights, both classes became the aristocracy. Both classes were wealthy. Both classes held seats in the senate and eventually both classes shared the counsulship.