Initialization of Arrays

 [Previous Chapter]  [Previous Page]  [Contents]  [Next Page]  [Next Chapter]

TestPoem.java
private static final String[] poem = {
   "The Lake Isle Of Innisfree",
   "",
   "I WILL arise and go now, and go to Innisfree,",
   "And a small cabin build there, "
      + "of clay and wattles made:",
   // ...
   "",
   "(William Butler Yeats, 1865-1939)",
};

*Instead of using the new operator it is also possible to initialize the whole array in its declaration.
 
*Syntax:

ComponentType [] ArrayName = {
    Component1, Component2, ...
};
 

 [Previous Chapter]  [Previous Page]  [Contents]  [Next Page]  [Next Chapter]
Copyright © 2001, 2002 Andreas Borchert, converted to HTML on February 11, 2002