If you have to pass some arguments to launch your application you can use this syntax java NameOfYourApplication arg1 arg2 arg3 ... You may acces those arguments within your main method (public static void main (Stringargs) where args represents the arguments the user have entered So you may do something like that if (args==...) I hope it helps!
By constantly trying one ends up succeeding. Thus: the more one fails the more one has a chance to succeed.
To prompt users and get input in a String : String name = JOptionPane.showInputDialog("Enter name " );
From the API for JOptionPane class at :http://java.sun.com/j2se/1.3/docs/api/
"showConfirmDialog Asks a confirming question, like yes/no/cancel. showInputDialog Prompt for some input. showMessageDialog Tell the user about something that has happened. showOptionDialog The Grand Unification of the above three. "
Do keep in mind that you can get some input from the user when the user invokes the application at the command line. java Whatever arg1 arg2 Here's the basic framework that displays all of the command line arguments when invoked from the command line:
thanks but please tell me how to accecpt multiple agrs like first the user will enter the number that no has to be accecpted & then when the user enters another no that no also has to be accecpted
posted 16 years ago
Abdul, It sounds like you'll want to implement Pradyumna's example above, adding to it some logic testing the validity of the initial input, then reusing Pradyumna's example if the input was accepted. If you were to post an example of what you've figured out so far, then others could best help you out. Good Luck.