can we declare an interface method static in java?

No, we cannot declare an interface method static in java because interface methods are abstract by default, and static and abstract keywords can’t be used together.

Example

interface SubtractionTest {
 
    static void subtraction(int num1, int num2);
 
 }
 
public class Main implements SubtractionTest
{
    void subtraction(int num1, int num2) {
        System.out.println(num1 - num2);
    }
 
	public static void main(String[] args) {
		Main main = new Main();
		main.subtraction(150, 100);
	}
}

Output

Main.java:3: error: missing method body, or declare abstract
    static void subtraction(int num1, int num2);
                ^
1 error

Java interview questions on interface and abstract class

Please Share