Are variables declared in static methods static by default? TM
Jui Mahajan
Ranch Hand
Joined: Jun 02, 2003
Posts: 62
posted
0
No, the variables in a static method cannot be static by default;they have to be declared explicitly static.By default, they r non-static
-----jui<br />scjp1.4
Carl Trusiak
Sheriff
Joined: Jun 13, 2000
Posts: 3340
posted
0
Variables declared in a method are neither static (Class Variables) or non-static (Instance Variables) they are Automatic Variables (or Local Variables) and as such are not part of the state of an Object which is they only way static and non-static have any context. JLS 8.3.1 http://java.sun.com/docs/books/jls/first_edition/html/8.doc.html#37544