1

Just starting to learn Java, I found that "String" in this function has two square brackets beside:

public static void main (String[] parameter){
    System.out.println("hello world");
}

But this one has not:

public void setName(String name){
    this.name = name;
}

What is the diference?

RomanVenica
  • 87
  • 1
  • 1
  • 11

1 Answers1

3

[] signifies an array, or a list of many Strings, whilst String is just one String.

Natecat
  • 2,066
  • 1
  • 15
  • 20