![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Hobbyist Programmer
Join Date: Mar 2005
Posts: 148
Rep Power: 4
![]() |
Question about the command line parameters
You know the familiar String[ ] args between the parentheses in the main method in Java? I've been doing some research and looking for arguments whether or not it's okay to write it String args[ ] instead. Because I'm used to working in C++, I'm used to doing it the latter way instead. But I believe I read on one site that you really should keep it String[ ] args. One of the reasons they gave was that if you were to return an array from a method, you would have to write it like that, not the other way.
I know one thing I probably will end up doing my own way is the Allman style of aligning your braces, instead of the hanging brace style which I can't stand. But I could probably get used to the String[ ] args though if that is a better way to do it. What is the opinion here? |
|
|
|
|
|
#2 |
|
Professional Programmer
|
I guess you could consider it clearer code:
You have String[] args -> a string array that is named args. but i guess it's more of a preference in Java. In C# is mandatory ![]()
__________________
Don't take life too seriously, it's not permanent ! |
|
|
|
|
|
#3 |
|
Troll
Join Date: Apr 2005
Location: Texas
Posts: 732
Rep Power: 4
![]() |
To be honest, I didn't even know that they were both legal. Type[] makes much more sense to me.
__________________
MD5(sig) = bcef75433db02e9ad9bf81d6f7c5c270 |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| C++ default parameters | n3o_X | C++ | 3 | Apr 28th, 2007 1:02 PM |
| Attitudes | Oddball | Coder's Corner Lounge | 29 | Mar 18th, 2006 9:34 PM |
| How to post a question | nnxion | C++ | 10 | Jun 3rd, 2005 11:53 AM |
| How to post a question | nnxion | C++ | 0 | Jun 3rd, 2005 8:55 AM |
| How to post a question | nnxion | C | 0 | Jun 3rd, 2005 8:55 AM |