PDA

Click to See Complete Forum and Search --> : Compiling Classes


lenin
Feb 7th, 2001, 04:13 PM
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

sail3005
Feb 7th, 2001, 08:43 PM
i think that you would compile the subclass first, and then the super class.

lenin
Feb 8th, 2001, 02:47 PM
How so? The subclass extends the superclass, compiling the subclass would mean it has no know;edge of the superclass??

Dillinger4
Feb 8th, 2001, 06:42 PM
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 {

lenin
Feb 9th, 2001, 02:51 PM
Thanks Dilenger.


Lenin