Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

interface in java

In many cases, it is more important to know what an object can do,instead of 
how it does what it does. This is a reason why interfaces are commonly used for
declaring a type of variable.
 interface : DrawingTool : a tool can draw
 interface DrawingTool {
    void draw(Curve curve);
}
DrawingTool pencil = new Pencil();
DrawingTool brush = new Brush();
Both Pencil and brush class should implement draw method
Source by www.tutorialspoint.com #
 
PREVIOUS NEXT
Tagged: #interface #java
ADD COMMENT
Topic
Name
7+6 =