Hi,
I'm working through Exercise 1.1 of the Sierra and Bates SJCP book. I have an abstract file Fruit.java:
and the class Apple :
Apple.java is in directory Exercise 1.1 and Fruit.java is in Exercise 1.1/food
I try various attempts at compiling and get:
C:\Users\Marlon\workspace\Exercise 1.1>javac Apple.java food\Fruit.java -cp food
Apple.java:1: food.Fruit is not public in food; cannot be accessed from outside
package
import food.Fruit;
^
food\Fruit.java:2: duplicate class: food.Fruit
abstract class
Fruit
^
Apple.java:2: cannot access Fruit
bad class file: food\Fruit.java
file does not contain class Fruit
Please remove or make sure it appears in the correct subdirectory of the classpa
th.
class Apple extends Fruit {
^
C:\Users\Marlon\workspace\Exercise 1.1>javac Apple.java -cp food
Apple.java:1: package food does not exist
import food.Fruit;
^
Apple.java:2: cannot access Fruit
bad class file: food\Fruit.java
file does not contain class Fruit
Please remove or make sure it appears in the correct subdirectory of the classpa
th.
class Apple extends Fruit {
I'm not sure what is going on. Fruit is abstract so that implies coderanch, correct? I have tried adding public explicitly and it didn't make a difference.