Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jul 21st, 2007, 3:50 AM   #1
357mag
Hobbyist Programmer
 
Join Date: Mar 2005
Posts: 148
Rep Power: 4 357mag is on a distinguished road
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?
357mag is offline   Reply With Quote
Old Jul 21st, 2007, 5:28 AM   #2
xavier
Professional Programmer
 
xavier's Avatar
 
Join Date: Oct 2004
Location: .ro
Posts: 371
Rep Power: 4 xavier is on a distinguished road
Send a message via Yahoo to xavier
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 !
xavier is offline   Reply With Quote
Old Jul 21st, 2007, 6:55 AM   #3
Dameon
Troll
 
Dameon's Avatar
 
Join Date: Apr 2005
Location: Texas
Posts: 732
Rep Power: 4 Dameon is on a distinguished road
To be honest, I didn't even know that they were both legal. Type[] makes much more sense to me.
__________________
MD5(sig) = bcef75433db02e9ad9bf81d6f7c5c270
Dameon is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

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




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 2:35 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC