简体   繁体   中英

Unable to use System.out in Java

public class Main{
    public static void main(String[] args){
        new World();

        System.out.println("HelloWorld Java");
    }
}

Compiling with javac results in this error:

C:\Users\Ben\Documents\GitHub\ECS\src\Main.java:5: error: cannot find symbol
    System.out.println("HelloWorld Java");
          ^
symbol:   variable out
location: class System

It's the most puzzling error I've ever gotten. Although I suppose it's important to note that this is my first real programming without the use of an IDE.

You have a local class called System. Don't use standard JDK names for your own classes.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM