5

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?

DwB
  • 37,124
  • 11
  • 56
  • 82
MK.
  • 33,605
  • 18
  • 74
  • 111
  • 3
    While 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

0 Answers0