Originally Posted by
izzahmed
so to correct this when i put the static void main(String[]args) so many other errors come again!!!
public class SmallestIndex {
public static void main(String[]args){
static final int LINESIZE = 10;
static final int MAXSIZE = 50;
static final int MINVALUE = Integer.MIN_VALUE;
private static int arrSize = 0;
//This method returns the index of the smallest value in the array of given size
public static void smallestIndex (int[] array) {
int currentValue = array[0];
int smallestIndex = 0;
for (int j=1; j < arrSize; j++) {
if (array[j] < currentValue)
currentValue = array[j];
}
System.out.println();
System.out.println("The smallest index is: "+ currentValue);
}
public static void printArray(int[] array) {
System.out.println("The numbers in the array are: ");
for (int j=0; j< arrSize; j++) {
if (j%LINESIZE == 0 )
System.out.println();
System.out.printf("%5d", array[j]);
}
}
}
}
i get the errors 16
illegal start of expression - 8 errors
';' expected - 5 errors
'.class' expected - 2 errors
You cannot have "inner methods" in java. It looks like you have a method inside the main method.