What is the output(static field and method)? : Questions « Modifiers « SCJP

1.Java Source And Data Type
4.Type Casting
6.Object Oriented
8.Utility Classes
SCJP » Modifiers » Questions 
3.15.15.What is the output(static field and method)?
class MainClass {
  static int x = 8;

  static {
    x += 2;

  public static void main(String args[]) {
    System.out.println("x = " + x);

  static {
    x /= 2;
3.15.1.Is it legal: default String s;
3.15.2.Answer: default accessor
3.15.3.Is it legal: transient int i = 1;
3.15.4.Answer: transient type
3.15.5.Is it legal: public final static native int w();
3.15.6.Answer: final static type
3.15.7.Is it legal: abstract double d;
3.15.8.Answer: abstract type
3.15.9.Is it legal: abstract final double aMethod();
3.15.10.Answer: abstract final method
3.15.11.An abstract class may not have any final methods (True/False)
3.15.12.Answer: abstract class and final method
3.15.13.A final class may not have any abstract methods (True/False)
3.15.14.Answer: final class and abstract method
3.15.15.What is the output(static field and method)?
3.15.16.Answer: static field and method
3.15.17.What is the output(static vs class instance)?
3.15.18.Answer: static vs class instance
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.