public class SelectionSort
{public static void main(String[] args)
{
int k;
int j;
int m;
int[] N;
k = Console.readInt("Input k: ");
N = new int[k];
for(int i=0;i<k;i++)
{
N[i] = Console.readInt("Input N["+i+"]: ");
}
int[]x = N;
int marker = N.length;
int max = x[0];
for(j=0; j<k; j++);
{
for(m=0; m<k; m++);
{
if(x[m+1]>=x[m]){
max = x[m+1];
}
}
System.out.println("The largest number is:" + max);
}
}
}
after running this code got array index out of bound error
plz help me

New Topic/Question
Reply




MultiQuote



|