I create an method local Inner Class and combine with abstract class. The code work fine but I do not understand the error popup in IntelliJ about I can't set Method in inner class that extend from abstract inner class to be private.
I have to change from "Private InnerClassSubclass" to "Public InnerClassSubclass" and if I won't the error is follow:
'innerMethod()' in 'InnerClassSubclass' clashes with 'innerMethod()' in 'InnerClass'; attempting to assign weaker access privileges ('private'); was 'public'.
I thought private is stronger privilege isn't it? only allow class within the same class to access.
I also try to change 'abstract class InnerClass' to 'private abstract class InnerClass' also got this error;
"Modifier 'private' not allowed here" at private of 'private abstract class InnerClass'
the code is below:
    public class Outerclass {
    // instance method of the outer class
    private void outer_Method() {
        int num = 23;
        // method-local inner class
        abstract class InnerClass {
            abstract public void innerMethod();
        } // end of inner class
        class InnerClassSubclass extends InnerClass {
            public void innerMethod() { //if I extends, I can't use private for innerMethod here.
                System.out.println("This is method inner class " + num);
            }
        }
        // Accessing the inner class
        new InnerClassSubclass().innerMethod();
    }
    public static void main(String args[]) {
        Outerclass outer = new Outerclass();
        outer.outer_Method();
        }
    }
Could someone clarify me why? Thank you.
 
     
     
     
    