Create a 20 by 30 array of String objects : Array Elements « Java Source And Data Type « SCJP

Home
SCJP
1.Java Source And Data Type
2.Operators
3.Modifiers
4.Type Casting
5.Statements
6.Object Oriented
7.Thread
8.Utility Classes
9.File
SCJP » Java Source And Data Type » Array Elements 
1.17.5.Create a 20 by 30 array of String objects
public class MainClass {
  public static void main(String[] argv) {
    String[][] s = new String[20][30];
    // The above notation is also equivalent to the following:

    s = new String[20][];
    for (int i = 0; i < 20; ++i)
      s[inew String[30];

  }
}
1.17.Array Elements
1.17.1.Array Element Initialization Values
1.17.2.Combine declaration, construction, and initialization into a single step
1.17.3.The array size is inferred from the number of elements within the curly braces.
1.17.4.An array can be initialized by assigning a value to each element
1.17.5.Create a 20 by 30 array of String objects
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.