Okay so I am in an online class, and at this point I really regret it. There isn't any teaching, just a book an assignment and go. And this stuff is just not working out for me. This week we are suppose to be working with objects. I am suppose to make a class animal, and then three objects; cat, dog, lion. And when I read it in the text book or the other book I bought or online it makes sense, but every single time I try to compile it I get the cannot find symbol error. Several times I have copied the example directly from the book and still get the error.
So here is the example from the book:
class Dog {
int size;
String breed;
String name;
void bark() {
System.out.println("Ruff!");
}
}
class DogTestDrive {
public static void main (String[] args) {
Dog d = newDog();
d.size = 40;
d.bark();
}
}
This is right out of the book I bought but when I type it up I get an error for the newDog(). Can anyone please explain to me why? I thought maybe since they are different things they needed to be in different files, that didn't work so I put them back on the same file...that didnt work either. Whoever helps me with this will by my hero for a long long time.
Thanks,