Friday 23 December 2011

Difference between class, abstract class and interface

Following are the difference between the Classes and Interface

1. The interfaces are used in java to implementing
the concept of multiple inheritence whereas classes
are not used to implement multiple inheriyence.

2. We are not allocating the memory for the
interfaces whereas the memory is allocated for
the classes

3. Interfaces are always implemented whereas clases
are always extended 




interface is little bit like a class... but interface is lack in instance variables....that's u can't create object for it.....
2.interfaces r developed to support multiple inheritance...

3.the methods present in interfaces r pure abstract..

4.the access specifiers public,private,protected r possible with classes.but the interface uses only one spcifier public.....

5.interfaces contains only the method declarations.... no definitions.......  




1) Abstract class defines few or none of the methods, but 
interface defines all the methods..
2) Abstract classes should have subclasses else that will 
be useless..
Interfaces must have implementations by other classes else 
that will be useless
3)only an interface can extend another interface, but any 
class can extend an abstract class..
4)All variable in interfaces are final by default

0 comments:

Post a Comment

 

Copyright @ 2013 Appychip.

Designed by Appychip & YouTube Channel