java code problem.....

Discussion in 'Software' started by conteh, Jun 25, 2008.

  1. conteh

    conteh

    Joined:
    Jun 20, 2008
    Messages:
    1
    Im having a problem with this code.could somebody help?....

    public class WriteAMessage
    {
    public static void main(String []args)
    {
    if(null == args || args.length < 1)
    {
    System.out.println("No message to print. Sorry.");
    System.exit(1);
    }

    }//end the if block

    String message = new String();

    //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
    Last edited: Jun 25, 2008
    conteh, Jun 25, 2008
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Fernando Kohan

    JAVA VIRTUAL MUCHINE OR SUN JAVA

    Fernando Kohan, Nov 13, 2004, in forum: Firefox
    Replies:
    1
    Views:
    834
    Clark
    Nov 14, 2004
  2. dakine

    MS Java or Sun Java???

    dakine, Jul 20, 2004, in forum: Computer Support
    Replies:
    9
    Views:
    1,457
  3. emerald
    Replies:
    3
    Views:
    12,759
    The Modfather
    May 14, 2006
  4. chuck

    Firefox and Java - but no Java

    chuck, Mar 19, 2007, in forum: Firefox
    Replies:
    1
    Views:
    363
    Peter.Potamus.the.Purple.Hippo@gmail.com
    Mar 19, 2007
  5. -Dan-
    Replies:
    0
    Views:
    553
    -Dan-
    Aug 5, 2005
Loading...

Share This Page