Talk:Interface (Java): Difference between revisions

Content deleted Content added
Line 19:
 
but can any interfaces(e.g Connection) have defined methods(e.g createStatement)?
 
An interface will not have any body(definition) in it's method. It's method are made to be overrode. Think of an interface as a contract. Every method in that contact must be used in your class. You must implement all methods from an interface in the class that will use it. In that class you will override the interfaces methods and give them their body .
 
here is a sample interface
 
public interface DriveCar {
 
// constant declarations, if any
 
//notice the methods have no bodies
int switchLane(double mph, double mphFinal);
int Turn(boolean turnSignal);
}