+ 1
what is main difference between class and interface??
3 Answers
+ 3
Class :Â A Java class is a virtual construct in Programming world, which can be instantiated to create Logical object to represent a Physical entity in the Virtual / Programming environment.Â
Every Object instantiated from a Class will have a state, and a behavior. These objects will communicate with other Objects in their virtual world using this behavior. We will take a deep dive about this communication between the objects in a short while.Â
Interface :Â A Java Interface is also a virtual construct in programming world, but in contrary to the Java Class, Interface can not be instantiated or created ans an object. An Interface denotes a group of logical entities. It can also act as a contract between two sub systems, while communicating with each other.
+ 2
Interfaces are syntactically similar to classes, but they lack instance variables, and their methods are declared without any body.
One class can implement any number of interfaces.
Interfaces are designed to support dynamic method resolution at run time.
+ 1
An interface is a fully abstract class.