Classpath

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hardik shah
    New Member
    • Jul 2007
    • 4

    #1

    Classpath

    Hi,

    I am new to java.

    I have developed a single file

    class cname
    {
    import java.io.*;
    {
    public static void main (Strings args[])
    {
    // some code
    }
    }

    when i compile above programme, i found follwoing error
    import java.io - illegal of start type
    ^

    I think it may be due to improper classpath setting.

    any help will be sincerely appreciated.


    Hardik Shah
  • JosAH
    Recognized Expert MVP
    • Mar 2007
    • 11453

    #2
    Originally posted by hardik shah
    Hi,

    I am new to java.

    I have developed a single file

    class cname
    {
    import java.io.*;
    {
    public static void main (Strings args[])
    {
    // some code
    }
    }

    when i compile above programme, i found follwoing error
    import java.io - illegal of start type
    ^

    I think it may be due to improper classpath setting.

    any help will be sincerely appreciated.


    Hardik Shah
    Java's syntax is a bit different; from to top bottom, you have to do this:

    1) an (optional) package statement (you dont' need one for now);
    2) all the classes you'd need to import;
    3) your class or interface definition(s).

    So your file should look like this:

    [code=java]
    import java.io.*;

    class cname {

    public static void main (Strings args[]) {
    // some code
    }
    }
    [/code]

    When you want to post some more, have a look at the little pane to the right
    of the edit window: it explains how to make your code look like code.

    kind regards,

    Jos

    Comment

    Working...