This question is from book scp for java6 by Kathy & Bert
excercise for reader -
Create an abstract superclass named
Fruit and a concrete subclass named Apple. The superclass should belong to a package called food and the subclass can belong to the default package . Make the superclass public and give the subclass default access.
1. Create the superclass as follows:
package food;
public abstract class Fruit{ /* any code you want */}
2. Create the subclass in a separate file as follows:
import food.Fruit;
class Apple extends Fruit{ /* any code you want */}
3. Create a directory called food off the directory in your class path setting.
JDK path : C:\Program Files\Java
I have not set CLASSPATH in the environment variable (default it looks into current directory).
The files where my
java programs (programs which i write for practise) are stored in C:\JavaFiles folder so my question is -
Create a directory called food off the directory in your class path setting (question in the book), where exactly do i have to place the food folder which has the fruit class in it ?
So what i Did was placed
The fruit.java file in c:\javaFiles\Food\Fruit.java
The apple.java file in c:\javaFiles\Apple.java
compiled it
c:\javaFiles> javac Fruit.java
c:\javaFiles> javac Apple.java
and there was no error.. after i run the program..
But i am a bit embarrassed to ask what does the point 3 in the question askin me to do.. (set ClassPath ? )