1int[] numbers = new int[5]; /* Empty array of type int and size 5 */
2String[] names = new String[10]; /* Empty array of type string and size 10 */
1//where n is the length you want the array to be
2// for integer array
3int[] intArray = new int[n];
4// for String array
5String[] strArray = new String[n];
1public static void main(String args[])
2{
3 int array[] = new int[4];
4 int number = 5, i = 0,j = 0;
5 while (i<4){
6 array[i]=number;
7 i=i+1;
8 }
9 while (j<4){
10 System.out.println(array[j]);
11 j++;
12 }
13}