I am lost learning for an exam right now. I try to understand why the Output 4 throws an exceptions while 5 works, since f is from type C1_A.
The Error 4 throws: Exception in thread "main" java.lang.Error: Unresolved compilation problem: mt_A cannot be resolved or is not a field at C1_O.main(C1_O.java:15)
public class C1_A {
    static int [] a = {4,3,2,9};
    public int mt_A(int b) {
        int[] a = {31,30,29};
        return(a[b]);
    }
}
public class C1_O {
    public static void main (String args[]){
        int a=2;
        int b=2;
        int c=a;
        int d;
        C1_A f = new C1_A();
        a = C1_A.a[b];
        System.out.println(a); //Output 1
        System.out.println(c); //Output 2
        System.out.println(f.mt_A(a)); //Output 3
        C1_A.a[c+1]= 2;
        d=C1_A.a[c-1];
        System.out.println(f.mt_A(d)); //Output 4
        System.out.println(f.mt_A(C1_A.a[3])); //Output 5
    }
}
 
    