My Question is about interface. I create an interface and define four methods: first method is a private method; second is a default method; third is a static method; and fourth is an abstract method.
After compiling this interface and checking its profile: the default method is converted into a public method, and both the static and abstract methods have a prepended public modifier. Why is this?
Code:
 interface InterfaceProfile {
    private void privateM() {   //this method is hidden
        System.out.println("private Method");
    }
    default void defaultM() {
        System.out.println("Default Method");
    }
    static void staticM() {
        System.out.println("Static Method");
    }
    void doStuff(); //by default adds the public modifier
}
InterfaceProfile class
    D:\Linux\IDE\Workspace\OCA-Wrokspace\Ocaexam\src>javap mods\com\doubt\session\InterfaceProfile.class
Compiled from "InterfaceProfile.java"
interface com.doubt.session.InterfaceProfile {
  public void defaultM();
  public static void staticM();
  public abstract void doStuff();
}
 
     
     
     
    