Results 1 to 5 of 5

Thread: Compiling Classes

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Feb 1999
    Location
    Belfast
    Posts
    254
    Hi,
    a simple question. If I have two classes, one of which inherits functionality from the other, is there a particular compiling method. I presumed that I should compile the superclass first then the subclass, but the subclass doesn't find the superclass. Do I have to import it in some way? I'm new to this.


    D:\jdk1.2.1\bin>javac ..\..\java\Point.java

    D:\jdk1.2.1\bin>javac ..\..\java\Circle.java

    ..\..\java\Circle.java:4: Superclass Point of class Circl
    e not found.
    public class Circle extends Point { // inherits from Point
    ^
    1 error

    D:\jdk1.2.1\bin>

    THANKS

    Lenin

  2. #2
    PowerPoster sail3005's Avatar
    Join Date
    Oct 2000
    Location
    Chicago, IL, USA
    Posts
    2,340
    i think that you would compile the subclass first, and then the super class.

    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Feb 1999
    Location
    Belfast
    Posts
    254
    How so? The subclass extends the superclass, compiling the subclass would mean it has no know;edge of the superclass??

  4. #4
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418
    Im pretty sure that you only compile the super
    class and then any class or classes the extend off of it
    are compile automatically. But if the classes are in
    diffrent files you have to add an import statement
    at the top

    import java.Point.*;

    public class Circle extends Point {

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Feb 1999
    Location
    Belfast
    Posts
    254
    Thanks Dilenger.


    Lenin

Posting Permissions

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



Click Here to Expand Forum to Full Width