I have the following code:
public class A {
 private Integer a=7;
 
 public int get_a() {
    return a;
    
 }
}
public class B extends A{
}
public class Main {
    public static void main(String[] args) {
        B obiect1=new B();
       System.out.println( obiect1.get_a());
    
       
    }
}
The Variabile "a" is private so will not be inherited by class B, but method "get_a()" is public so it will be inherited by class B. In "main()" method when I call "obiect1.get_a()" what will happen sice class B doesn't have variabile "a"? It will show 7 on console but why? B doesn't inherited variabile "a". What is actually happen
 
     
    