public static void main (String args []) {
int[] array={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20};
for (int c=0; c<20; c++)
System.out.print (array[c]+" ");
System.out.println ("");
String a=JOptionPane.showInputDialog ("Enter number search:");
int search=Integer.parseInt (a);
for (int b=0; b<20; b++){
if (array[b]==search)
break;
if (b==20)
System.out.println (search+" not found!");
else if (search>20)
System.out.println (search+" not found!");
else
System.out.println ("Found "+search);
break;
}
for (int b=0; b<array.length; b++){
if (array[b]==search)
break;
for (int k=b; k<array.length; k++)
array[k]=array[k+1];
array.length--;
}
for (int f=0; f<20; f++)
System.out.print (array[f]+" ");
System.out.println ("");
}
}
but there is an error saying that cannot assign a value to final variable length...
help again???
thanks a lot!!!!


Sign In
Create Account


Back to top









