Hi
I m getting this error while i m trying to run my program and i don't understand why that happens.
I m getting this error while i m trying to run my program and i don't understand why that happens.
Code:
import java.util.*;
public class Exercise6 {
public static void main(String Args[]) {
Scanner sc = new Scanner(System.in);
System.out.println("Please enter 12 desired numbers that" +
" you wish to sort from a range 0-9.");
int array[]= new int[12];
for(int k=1; k<=array.length; k++) {
System.out.print(k+ ":");
int number = sc.nextInt();
array[k] = number;
if(k==12) {
for(int i=1; i<=array.length; i++) {
System.out.print(array[i]);
}
}
}
}
}
Comment