java beginner - OS 10.4 - using terminal and Head First Java text to self learn - old BASIC person from years ago -
get the following error:
Exception in thread "main" java.lang.NoClassDefFoundError: GoodDogTestDrive/class
code below - would also like to know how to run code with 2 classes - everything is in the same directory
-------------
class GoodDog {
private int size;
public int getSize() {
return size;
}
public void setSize(int s) {
size = s;
}
void bark() {
if (size > 60) {
System.out.println("Woof Woof !");
} else if (size > 14) {
System.out.println("Ruff Ruff!");
} else {
System.out.println("Yip Yip!");
}
}
}
class GoodDogTestDrive {
public static void main (String[ ] args) {
GoodDog one = new GoodDog();
one.setSize(70);
GoodDog two = new GoodDog();
two.setSize(8);
System.out.println("Dog one: " + one.getSize());
System.out.println("Dog two: " + two.getSize());
one.bark();
two.bark();
}
}
get the following error:
Exception in thread "main" java.lang.NoClassDefFoundError: GoodDogTestDrive/class
code below - would also like to know how to run code with 2 classes - everything is in the same directory
-------------
class GoodDog {
private int size;
public int getSize() {
return size;
}
public void setSize(int s) {
size = s;
}
void bark() {
if (size > 60) {
System.out.println("Woof Woof !");
} else if (size > 14) {
System.out.println("Ruff Ruff!");
} else {
System.out.println("Yip Yip!");
}
}
}
class GoodDogTestDrive {
public static void main (String[ ] args) {
GoodDog one = new GoodDog();
one.setSize(70);
GoodDog two = new GoodDog();
two.setSize(8);
System.out.println("Dog one: " + one.getSize());
System.out.println("Dog two: " + two.getSize());
one.bark();
two.bark();
}
}