Sometimes you want to initialize array at runtime as you are not aware of its size at start. Following code does exactly that:

Java Code:
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));	
System.out.println("Please enter size of the array: ");
int size = Integer.parseInt(br.readLine());
int[] array = new int[size];
System.out.println("Size of array is: " + array.length);
Output:
Java Code:
Size of array is: 5