Question 3 Analyze the code below Identify all of the illega
Solution
First thing i have observed that as you are using the public static void test2() inside this getting compilation error on x,y , foo() and faz() because of you can not call or declare non-static mehtod or function and variable in static method or function.
To remove the error please make it either method not static or make it x,y , foo() and faz() static.
below is the correct code
-------------------
public class A3 {
   public static int u;
   
    private static int v;
   
    private static int x;
   
    private static int y;
   
    public static void foo(){}
   
    public static void far(){}
   
    private static void faz(){}
   
    private static void fiz(){}
   
    public void test1(){
       
        u=1;
       
        v=2;
       
        x=3;
        y=4;
       
       
        foo();
       
        far();
        faz();
        fiz();
    }
   
   
 public static void test2(){
       
        u=5;
       
        v=6;
       
        x=7;
        y=8;
       
       
        foo();
       
        far();
        faz();
        fiz();
    }-------------------
Please paste the code on tool and see you will not get any compiler error.


