Why is it that in Java class fields are initialized to null/0 and local variables are not? Is there a reason for this language design choice?
Asked
Active
Viewed 99 times
5
-
3While this is an interesting question, I'm not sure that you'll be able to get a definitive answer from anyone here at Stack Overflow. You'd probably have to ask the language designers. – templatetypedef Apr 03 '13 at 19:06
-
The reason that java local variables do not have a default value is because in the design of the java language it was decided that local variables do not have default values. – DwB Apr 03 '13 at 19:08