The variables of an interface are always declared as "final". Final variables are those variables, whose values are constants and cannot be changed. The class that implements the interface can use the variables as declared in the interface and cannot modify or changed the value of the variable.
public void choose(int color);
class selectimp implements selectcolor
public void choose(int color)
System.out.println("The color selected is blue");
System.out.println("The color selected is yellow");
System.out.println("The color selected is pink");
public static void main(String aa)
selectimp st=new selectimp();
In this example first an interface selectcolor is created and the value for the integers blue, yellow, pink are set as 4,5,6.
Then a method choose() which takes an integer parameter is declared.
A class selectimp is created, which implements the interface selectcolor.
Then the method choose() of the interface selectcolor is implemented using the switch case statements.
Then there is a main() which creates the object of the class selectimp and call the choose() of the selectimp class with different parameters or arguments.