Originally posted by Maduranga Liyanage:
1)Does variables or class instances created inside a try has a scope inside the try block only?
Yes. This is true of any set of braces ("{}"): try blocks, blocks that form the bodies of loops, etc.
Since I dont get a error in my code, I beleive that static variables are initialzed to default of 0. But is it right?
Static variables are default-initialized just like instance variables.
You might have read about static
final variables needing to be initialized. All final variables, by definition, have to be initialized somewhere -- static or otherwise.