what is main difference between class and interface?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

what is main difference between class and interface??

18th Sep 2016, 5:29 PM
balram sao
balram sao - avatar
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.
15th Oct 2016, 10:58 AM
Nareg
Nareg - avatar
+ 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.
14th Oct 2016, 11:54 PM
Zakaria Makhlouf
Zakaria Makhlouf - avatar
+ 1
An interface is a fully abstract class.
15th Oct 2016, 11:03 AM
Zen
Zen - avatar