Pages

Sunday, July 22, 2012

java block variables

class A{
  int x = 0;
 {x = 7; int x2=3;} //init block
  void doStuff(){
 //do something
}

}

x2 is an init block variable.

block variables cannot be accessed after the execution of the code block.

No comments:

Post a Comment