• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

Array initialization question 2

 
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Per Java 2 Certification Study Guide, p 13, " When an array is constructed, its elements are automatically initialized exactly as for object member variables" (i.e. byte 0, char '\u0000').
Are local/method arrays treated the same and are initialized by the compiler to the appropriate default? I was told that local arrays are not initialized but this contradicts the above reference. Which one is correct? If the local array is not initialized why the discrepancy? Thanks.
 
Ranch Hand
Posts: 1512
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, local variables for arrays ONLY are also inititlized to their default values, if they are not initialized.
Bosun
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!