Complete the code to declare an interface named Vehicle.
public [1] Vehicle {
void start();
}The keyword interface is used to declare an interface in Java.
Complete the code to declare a method named stop in the interface.
public interface Machine {
[1] stop();
}Interface methods are abstract by default and usually have no return value if they perform an action, so void is appropriate here.
Complete the code to explicitly declare an abstract method named reset in the interface.
public interface Device {
public [1] void reset();
}Interface methods are implicitly abstract, so adding abstract is correct and allowed.
Fill both blanks to declare an interface named Calculator with a method calculate returning an int.
public [1] Calculator { [2] calculate(); }
The keyword interface declares the interface, and the method calculate returns an int.
Fill all three blanks to declare an interface named Printer with a method print that takes a String parameter and returns nothing.
public [1] Printer { [2] print([3] message); }
Use interface to declare the interface, void as the return type for no return value, and String as the parameter type.