Results 1 to 4 of 4
  1. #1
    raghu9198's Avatar
    raghu9198 is offline Member
    Join Date
    Dec 2008
    Posts
    32
    Rep Power
    0

    Unhappy [SOLVED] commandline arguements

    hi all,
    this is raghu.
    I am trying to run a code to accept values from keyboard through command line but i am getting errors
    this is my code
    import java.io.*;
    class Arr
    {
    public static void main(String[] a)
    int i;

    System.out.println("The no of arguements are :"+n);
    System.out.println(" The args are :");
    for( i=0; i< a.length ; i++ )
    {
    System.out.println(a[i]);
    }
    and errors are :

    Arr.java:5: ';' expected
    int i;
    ^
    Arr.java:7: <identifier> expected
    System.out.println("The no of arguements are :"+n);
    ^
    Arr.java:8: <identifier> expected
    System.out.println(" The args are :");
    ^
    Arr.java:9: illegal start of type
    for( i=0; i< a.length ; i++ )
    ^
    Arr.java:13: <identifier> expected
    ^
    5 errors
    please help me in this regard confused:
    thanks,
    raghu

  2. #2
    mtyoung is offline Senior Member
    Join Date
    Dec 2008
    Location
    Hong Kong
    Posts
    473
    Rep Power
    6

    Default

    where '{' and '}' of main function?

  3. #3
    raghu9198's Avatar
    raghu9198 is offline Member
    Join Date
    Dec 2008
    Posts
    32
    Rep Power
    0

    Default

    thanks..........
    { , } were overlooked

  4. #4
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

    Default

    and where you define variable n. Where you define before use here.

    Java Code:
    System.out.println("The no of arguements are :"+n);

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •