Alexandra K
Alexandra K

Reputation: 71

I have no output in the Console - java - Eclipse

I have read some Q&A about a similar issue, but they did not fix my problem.

I have the next java file:

public static void main(){


     System.out.println("\n9. Create a program that wap 2 numbers (interchange them).");
     int aa;
     int bb;
     int aux;

     Scanner scanC = new Scanner(System.in);
     System.out.println("First number: " );
     aa = scanC.nextInt();
     System.out.println("Second number: " );
     bb = scanC.nextInt();

     System.out.println("Initial: " + "\n" + aa + "\n" + bb);
     aux = aa;
     aa = bb;
     bb = aux;
     System.out.println("Interchanged: " + "\n" + aa + "\n" + bb);


}

when I run it it does not bring any output. I just the the output for the last run java file before this one(I keep more than one java file open in Eclipse). I have tried modifying the Run configurations and I have closed and reopened Eclipse. Still nothing. Help please

Upvotes: 0

Views: 179

Answers (1)

Mena
Mena

Reputation: 48404

The signature of your main method doesn't make it an single point of entry main method.

Change the signature to:

public static void main(String[] args)

... or ...

public static void main(String... args)

And set the class up as your project main class if needed.

Upvotes: 3

Related Questions