nonstatic instance variables are initialized before the class constructor is executed : Member Variable « Java Source And Data Type « SCJP

Home
SCJP
1.Java Source And Data Type
2.Operators
3.Modifiers
4.Type Casting
5.Statements
6.Object Oriented
7.Thread
8.Utility Classes
9.File
SCJP » Java Source And Data Type » Member Variable 
1.20.8.nonstatic instance variables are initialized before the class constructor is executed
public class MainClass{
   public static void main(String[] argv){
      new MyClass();
   }
}
class MyClass{
   int x = 20;
   public MyClass(){
      System.out.println(x);
   }
}
1.20.Member Variable
1.20.1.Field Variables are variables that are declared as members of classes.
1.20.2.Field variables are declared using the following syntax: modifiers Type declarator;
1.20.3.Java supports two different kinds of variables: field variables and local variables.
1.20.4.Field variables of object types and the elements of arrays of object types are automatically initialized to the null value.
1.20.5.Initialization Values for Member Variables(the same as array element initialization values)
1.20.6.Default initializations of static and instance variables.
1.20.7.A member value may be initialized in its own declaration line:
1.20.8.nonstatic instance variables are initialized before the class constructor is executed
1.20.9.Non-initialized string instance variable
1.20.10.Array Instance Variables
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.