Phripheoniks
Phripheoniks

Reputation: 1

Eclipse giving error on a println method

Typing

System.out.println("Hello world");

into eclipse gives error on the second "." and on the ";".

The errror message looks like this:

Multiple markers at this line
    - Syntax error on token ".", @ expected after this token
    - Syntax error, insert "Identifier (" to complete 
     MethodHeaderName
    - Syntax error, insert ")" to complete MethodDeclaration
    - Syntax error, insert "SimpleName" to complete 
     QualifiedName

This has never happened before. Mind you, this is happening on a computer where I just installed Eclipse and the newest JDK for x64 windows 10. Might have something to do with it, but I'm clueless.

Thanks for any response! :)

Upvotes: 0

Views: 1782

Answers (1)

Benjamin
Benjamin

Reputation: 89

import java.util.Scanner;
public class Try
  {
    Scanner tastatur = new Scanner(System.in);
    double NOK = 1.0;
    double EUR = 9.34; 
    double USD = 8.46; 

 public static void Test(String args[]){
     System.out.println("");
  }
}

You can't use System.out.print() like that,you have to run it inside either a constructor or another method.

Upvotes: 2

Related Questions