• Post Reply Bookmark Topic Watch Topic
  • New Topic

Is String[] args[] similar to String[] args?  RSS feed

 
Winston Liek
Ranch Hand
Posts: 194
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is the logic between

String[] args[];
and
String[] args;

in terms of dimension?
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16060
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, String[] args[] means the same as String[][] args or String args[][], in other words, it's an array of arrays of Strings, not just an array of Strings.

In Java, it's better to put the [] always after the type name (for example, String[] args) and not after the variable name (String args[]). The syntax where you put the [] after the variable name was only added to Java to make it look familiar to C++ programmers. (In the 1990's, when Java was invented, C++ was a big language and Sun tried to get C++ programmers to learn Java).
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!