Answers for "implement the interface methods java"

1

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
Posted by: Guest on January-28-2022
0

do you have to implement all methods of an interface java

Yeah, unless the class is declared as an abstract class.
Posted by: Guest on January-09-2022

Code answers related to "implement the interface methods java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language