Results 1 to 7 of 7
  1. #1
    waqar100 is offline Member
    Join Date
    May 2010
    Posts
    28
    Rep Power
    0

    Default missing some import class(may be)

    Hi,Experts,I am a new one.
    I have made class in java,using netbeans 6.0.1 this getting error if i mouse over on the class name"class shape is public,should be declared in a file named shape.java",

    what i missed?

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,559
    Rep Power
    25

    Default

    class shape is public, should be declared in a file named shape.java
    The error message says what the problem is.
    The name of the file holding the shape class should be named shape.java because the class is public.

  3. #3
    pbrockway2 is offline Moderator
    Join Date
    Feb 2009
    Location
    New Zealand
    Posts
    4,565
    Rep Power
    12

  4. #4
    waqar100 is offline Member
    Join Date
    May 2010
    Posts
    28
    Rep Power
    0

    Default

    So,what is the solution,

    I may write
    public class shape.java
    instead of
    public class shape

  5. #5
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,651
    Blog Entries
    7
    Rep Power
    21

    Default

    Quote Originally Posted by waqar100 View Post
    So,what is the solution,

    I may write
    public class shape.java
    instead of
    public class shape
    No, name your class 'shape' (it's a bad name btw, it should start with a capital letter by convention) and name your source file shape.java. The java compiler wants the name of a public class to be X and the name of the source file X.java. Read some tutorials because this is really, really basic and you should know this.

    kind regards,

    Jos

  6. #6
    waqar100 is offline Member
    Join Date
    May 2010
    Posts
    28
    Rep Power
    0

    Default

    Thank you so much,
    actually i am a fresh for dotnet & just having theoritically knowledge of java.can you tell me about basic & best tutorial?

  7. #7
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,651
    Blog Entries
    7
    Rep Power
    21

    Default

    Quote Originally Posted by waqar100 View Post
    Thank you so much,
    actually i am a fresh for dotnet & just having theoritically knowledge of java.can you tell me about basic & best tutorial?
    The Java™ Tutorials

    kind regards,

    Jos

Similar Threads

  1. Iterator next import class?
    By daydreamer in forum New To Java
    Replies: 7
    Last Post: 10-04-2010, 11:32 PM
  2. import class
    By Dipke in forum New To Java
    Replies: 5
    Last Post: 08-09-2010, 10:54 AM
  3. how to Import my Java Class in Jsp Page
    By pos in forum JavaServer Pages (JSP) and JSTL
    Replies: 20
    Last Post: 04-06-2010, 02:51 PM
  4. can't import my own class
    By Splat in forum New To Java
    Replies: 5
    Last Post: 10-13-2009, 04:53 AM
  5. Already import the resources but images are missing
    By Java.child in forum New To Java
    Replies: 5
    Last Post: 09-05-2008, 05:09 PM

Posting Permissions

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