![]() |
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? |
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 :) |
To be honest, I didn't even know that they were both legal. Type[] makes much more sense to me.
|
| All times are GMT -5. The time now is 2:43 AM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC