George B
Posts: 24
Nickname: hmgeorge
Registered: Feb, 2008
|
|
Re: Problem with code
|
Posted: Jun 30, 2008 12:10 PM
|
|
You have an extra close-curly in there. Here's the code reformatted with the extra curly removed. This compiles ok.
public class LoopArguments {
public static void main(String []args) {
if (null == args || args.length < 1) {
System.out.println("No arguments to print. Sorry.");
System.exit(1);
}
String message = formatArguments(args);
message += formatArguments(args);
System.out.println(message);
}//end of the main method
public static String formatArguments(String msg[]) {
String myArgs = new String();
for(int i=0 ; i < msg.length ; i++) {
myArgs += msg[ i ] + " ";
}//end the for statement
return myArgs;
}//end formatArguments method
}//end the class
|
|