What is the output(static instance)? : Questions « Modifiers « SCJP






public class A {
  static int x;

  public static void main(String[] args) {
    A that1 = new A();
    A that2 = new A();
    that1.x = 5;
    that2.x = 1000;
    x = -1;
    System.out.println(x);
  }
}








3.16.Questions
3.16.1.Which is/are true?
3.16.2.Answer: interface and implementation
3.16.3.Which of the following may be declared final?
3.16.4.Answer: final class, method, and field
3.16.5.Which of the following may follow the static keyword?
3.16.6.Answer: static class, method and field
3.16.7.Which access modes may apply to B's version of doSomething()?
3.16.8.Answer: access modifier and inheritance
3.16.9.Any instance of Y may call the aMethod() method of any other instance of Y (True/False)
3.16.10.Answer: access modifier and multi-package
3.16.11.A final class may not be extended (true/false)
3.16.12.Answer: final and extension
3.16.13.What is the output(static instance)?
3.16.14.Answer: static instance