Static fields

Report a typo

You are given a class containing static and instance fields and methods:

class MyClass {

    long longField;
    static String strField;

    static void method2() { 
        System.out.println(strField);  // (1)
        System.out.println(longField); // (2)

    }

    void method1() { 
        System.out.println(strField);  // (3)
        System.out.println(longField); // (4)
    } 
}

Select all correct lines of code.

Select one or more options from the list
___

Create a free account to access the full topic