• Post Reply Bookmark Topic Watch Topic
  • New Topic

Scope of vars in a static block  RSS feed

 
P Teng
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi , a quick one please

The following code does not compile, complaining that it cannot find symbol : variable y.
Does this mean that variables in static or not static code blocks are limited in scope only to that block only if they have been declared there ?

 
Patricia Samuel
Ranch Hand
Posts: 300
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Exactly. y is local to that block and could not be accessed outside.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!