Hi praveen,
I tried the code and its gives the Correct output , i have added the code
and the sample output as well.
public class CommandLine {
public static void main (String argv[])
{
int length = argv.length;
String myString ="No of parameter:";
System.out.println (myString + length);
for (int i=0; i<length; i++)
{
myString = argv[i];
System.out.println(i + ":" + myString);
}
}
}
// End of Program
-------------------------------------------------
Output
--------------------------------------------------
C:\Documents and Settings\Comp\Desktop>java CommandLine Java is a good
language
No of parameter:5
0:Java
1:is
2:a
3:good
4:language
-----------------------------------------------------------------------------------
Regards
Syed Shabeer Ahmed
On Wed, Apr 13, 2011 at 11:26 AM, Parveen Thakur
<[email protected]>wrote:
>
>
>
> HI,
>>
>> when i run the programm it done not ask me for input as below ,I don't
>> understand wht think i missed
>
>
>
>> public class CommandLine
>> {
>> public static void main (String argv [])
>> {
>> int length = argv.length;
>> String myString = “No. of parameters”r
>> + “ on the command line: ”;
>> System.out.println (myString + length);
>> for (int i=0; i length; i++)
>> {
>> myString = argv[i];
>> System.out.println
>> (i + “: ” + myString);
>> }
>> }
>> }
>> • Input: java CommandLine Java is a good
>> language.
>> • Output: No of parameters on the command line: 5
>> 0: Java
>> 1: is
>> 2: a
>> 3: good
>> 4: language.
>>
> --
> To post to this group, send email to
> [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/javaprogrammingwithpassion?hl=en
>
--
Regards
Syed Shabeer Ahmed
--
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/javaprogrammingwithpassion?hl=en