Java eclipse String Error

前端 未结 5 732
夕颜
夕颜 2021-01-19 10:16

I\'m New to Java and I am following some instruction, However When I get to the Strings section

public class String {
    public static void main(S         


        
5条回答
  •  余生分开走
    2021-01-19 11:06

    As your class hides the java.lang.String name, you need to write

    public static void main(java.lang.String[] args) {
    

    Better call your class StringTest or something else to avoid this confusion.

    public class StringTest {
        public static void main(String[] args) {
            String name = "luke";
            System.out.println("Hello, " + name + "pleased to meet you");
        }
    }
    

提交回复
热议问题