PDA

View Full Version : Java - classes vs. interfaces



dnsd
January 15th, 2001, 12:43
Anybody explain me what is the theoritical difference between classes & interfaces in java?

I'm learning java 1.1 actually.

Pls tell me the sites of java resources.

cds
January 17th, 2001, 19:00
A class is essentially a Java object that has its own methods and properties and can be instantiated in its own right.

An interface is essentially a listing of methods that are required to be declared for any class that implements the interface.

There is no easy explanation as to why interfaces are used. But they will become extremely useful when you know what interfaces a class implements, because then you know what that class is capable of.

If you are just beginning Java, just work with classes for now...you will prob never use them if your programs consist only with your work. IF you do use them, look at some interfaces in the JDK documentation...