In java when we inherit a public superclass then why we can't make the subclass public.
public class Parent {
int value;
public void print(){
System.out.println("Hello Parent!");
}
public static void main(String[] args) {
Parent t = new Child();
}
}
public class Child extends Parent{ // error here
int val;
}
// showing error if I use public, private or protected with Child class.