Java eclipse String Error

前端 未结 5 815
夕颜
夕颜 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 10:49

    You were careful to fully-qualify your reference to java.lang.String for the name variable, but not for the args parameter to main.

    Use

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

    Of course, this all resulted because you named your class String, the same name as a built-in class in Java. Perhaps you could name it StringTest instead? That would avoid having to worry about class name collision and fully qualifying the Java built-in String.

提交回复
热议问题