i am a first year student and i dont have a clue whats going on. i keep getting this error:Exception in thread "main" java.lang.NoSuchMethodError: main
this is the code i am using but i dont think its releated to this.

public class reverse
{
	public static void main (String [] args)
	{
		int [] numbers = new int [5];

		System.out.println("Enter 5 numbers:");

		for(int i=0; i<5; i++)
			numbers [i] = Console.readInt();
		for(int i=4; i>=0; i--)	
			System.out.println(numbers[i] + " " );
		for(int i=0; i<5; i++)
			System.out.println(numbers[i] + " " );
		
	}
}

I am pretty sure you do know this, but Java is probably one of the few languages that the name of file that you wrote your program in is related to the code inside it.

To provide an example, in your case, the name of the file should be reverse.java. Casing is also important, so be aware!!

Secondly, I modified your code in this way, have a look:

import java.util.Scanner;
public class reverse
{
        public static void main (String [] args)
        {
                int[] numbers = new int [5];
                Scanner in = new Scanner(System.in);

                System.out.println("Enter 5 numbers:");

                for(int i=0; i<5; i++)
                        numbers[i] = in.nextInt();
                for(int i=4; i>=0; i--)
                        System.out.println(numbers[i] + " " );
                for(int i=0; i<5; i++)
                        System.out.println(numbers[i] + " " );

        }
}

ronan since you are new to this ,leaving the for loop without braces or the curly brackets as they said :) as not a good coding style so get used to bracket every thing that needs it because later you will find it so much better

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.