Array.newInstance
Class Overview | Class Members | 
  This Package | 
All Packages
 public static Object newInstance( Class componentType,
                                  int length ) throws NegativeArraySizeException
Parameters
-  componentType 
-  the Class object representing the
 component type of the new array
    
-  length 
-  the length of the new array
    
Returns
     the new array
    Description
 Creates a new array with the specified component type and
 length.
 The effect is that of the equivalent array creation expression:
 
    new componentType[length]
 
  
Exceptions
 NullPointerException
     if the specified
 componentType parameter is null
    
Exceptions
 NegativeArraySizeException
     if the specified length
 is negative
  
 public static Object newInstance( Class componentType,
                                  int dimensions[] ) throws IllegalArgumentException, NegativeArraySizeException
Parameters
-  componentType 
-  the Class object representing the component
 type of the new array
    
-  dimensions 
-  an array of ints representing the dimensions of
 the new array
    
Returns
     the new array
    Description
 Creates a new array with the specified component type and
 dimensions.
 The effect is that of the equivalent array creation expression:
 
    new componentType[dimensions[0]][dimensions[1]]...
 
  
Exceptions
 NullPointerException
     if the specified
 componentType argument is null
    
Exceptions
 IllegalArgumentException
     if the specified dimensions
 argument is a zero-dimensional array, or if the number of
 requested dimensions exceeds the limit on the number of array dimensions 
 supported by the implementation (typically 255).
    
Exceptions
 NegativeArraySizeException
     if any of the components in
 the specified dimension argument is negative.