Home » JAVA Programming » Characters » Question
  1. In below code, what can directly access and change the value of the variable name?

    package output;
    class Test
    {
    public String name = "Interview Mania";
    }
    1. any class that extends Test
    2. any class in the output package
    3. only the Test class
    4. any class
    5. None of these
Correct Option: B

Any class in the output package can access and change name.



Your comments will be displayed only after manual approval.