0

we can have two declaration for String array

1>String... sampleStringArray;

2>String sampleStringArray[];

can anyone tell me the difference

Anirudh Jadhav
  • 967
  • 1
  • 9
  • 23
  • here is something that might help: http://stackoverflow.com/questions/18288799/difference-between-a-string-and-an-array-of-characters – CSCH Apr 20 '15 at 04:09
  • Have a look at http://stackoverflow.com/questions/11973505/what-is-the-difference-between-string-and-string-in-java – Justin Apr 20 '15 at 04:09

1 Answers1

1

The first is an example of varargs and the wikipedia notes These values will be available inside the method as an array, must be the last parameter in a given method, and is otherwise accessed as an array (also it wasn't added to the language until Java 5).

Elliott Frisch
  • 198,278
  • 20
  • 158
  • 249