What is the difference between String[] and String… in Java?

前端 未结 5 713
面向向阳花
面向向阳花 2021-01-30 07:34

How should I declare main() method in Java?

Like this:

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


        
5条回答
  •  隐瞒了意图╮
    2021-01-30 07:46

    String[] is an array of Strings. Therefore a container of many variables of String data type. For example:

    String[] strArray = new String[2];
    str[0] = "Hello";
    str[1] = "World";
    
    String str = "Hello World";
    

    Hope this clears your queries :)

提交回复
热议问题