Sponsored Link •
|
Advertisement
|
Advertisement
|
This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.
Message:
All arrays' componenets in java are initialized by default to null. You don't need to initialize them explicitly unless you want to initialize all componenets of newly created array to a value other than null ( for reference type array ) . The error you got must be becuase you are not initializing any String object not any string array. For example System.out.println ( s[0] ) ; and it will print "null" because all reference array ( here String one ) are initialized to null. It doesn't matter whether is declared as a memeber of a class or local to a method. // The array s has been created before this line of code Thanx Replies: |
Sponsored Links
|