Skip to main content

Difference between Class and Interface

Java Programming


  *Difference between Class and Interface

                                                Class

1. The members of a class can be constant or variables. 

2. The class definition can contain code for each of its methods. That is, the methods can be    abstract or non-abstract.

3. It can be instantiated by declaring objects.

4. It can use various access specifier like public,private or protected. 


                                             Interface   

1. The members of an interface are always declared as constant, i.e. their values are final. 

2. The methods in an interface are abstract in nature, i.e., there is no code associated with   them. It is later defined by the class that implements the interface.

3.  It cannot be used to declare objects. It can only be inherited by a class. 

4.  It can only use the public access specifier.




Comments

RAW_BOY said…
nice way to explane
Abhishek said…
Thank you for your feedback

Popular posts from this blog

Byte Code:

Java Programming Byte Code: It is the unique characteristic property of the Java programming language. It is something like a normal text file. Therefore, it cannot be affected by virus. It is an intermediate between a human readable source and machine readable source. Byte codes are plate form independent. Therefore, JVM is plate form dependent to make Java programming plate form indepdent.  

OPERATING SYSTEM

1.  The term 'operating system'   means: a)  the way a computer operator   works. b)  conversion of high level languages into machine   code. c)  a set of programs which controls computer   working. d)  none of the   above. 2.  What is the name of the operating system that reads and reacts in terms of actual   time: a)   Batch   system b) Time sharing system c) Real   time   system d) all of the above. 3.  The primary job of the operating system of a computer is   to: a)   command   resources b) manage   resources c) be   user friendly d) only one of the   above. 4.  Multiprogramming   systems: a) are easier to develop than single programming systems. b) execute more jobs in same time period. c) are used only on large   mainframe   computers. d) all of the above 5.  Which of the following is not an a...