?

AP® Computer Science A

Free Version

Upgrade subject to access all content

Moderate

Accessing Variables in Words Class

APCSA-ENW4FV

Consider the following class.

public class Words 
{
    private String verb;
    public static String noun;
    public String adjective;

    public String getVerb()
    {
        return verb;
    }

    // other variables and methods not shown
}

Suppose that the following statement were executed first in another class.

Words w = new Words();

Which of the following statements from this other class would result in an error?

A
System.out.println(w.adjective);
B
System.out.println(w.verb);
C
System.out.println(w.noun);
D
System.out.println(Words.noun);
E
System.out.println(w.getVerb());