Cary wrote: myDogs[x].bark;
myDogs[x] is a reference to a Dog object
bark is a method of a HF_62 object
x = X + 1;
typo
kevin Abel wrote:
Cary wrote: myDogs[x].bark;
myDogs[x] is a reference to a Dog object
bark is a method of a HF_62 object
x = X + 1;
typo
1) I didn't notice the difference in case in the typo line. I fixed it.
2) Would it be OK to put the bark method in the Dog Class?
3) Is my Dog Class OK? It doesn't have much in it.
kevin Abel wrote:It will name all of the dogs Ralphy which maybe is better than null.
Carey Brown wrote:I'm afraid your "++" is wrong. You just wrote yourself an infinite loop.
cannot be referenced from a static context
Dog in Dog() cannot be applied
Norm wrote:Did you add a constructor to the Dog class that takes a String as argument?
Does your IDE high-light or color the source code? Look at the above code that is formatted. Compare the coloring of lines 20 and 24. Notice some is blue and some is black. Blue is for java keywords. Black is just text.
I still have the other errors.
Make your machine help you. Get a text editor that supports bracket matching. Enable bracket matching on your IDE. Choose a colour that you will see easily.kevin Abel wrote:I think that I balanced the brackets correctly. I had trouble seeing them in C. . . .
Where did that error occur? I can't see it. I think that error message misleads many people because it suggests there is something “normal” about things static.. . . HF_62.this cannot be referenced from a static context . . .
I didn't notice it was an inner class; I am sure it should have been a top‑level class and that is an indentation/bracket matching problem.Norm Radder wrote:. . . The Dog class as declared belongs to an instance of the HF_62 class. . . .
/Java cannot find symbol
You can't use classes as objects; you can however make object from classes, which is called instantiating the class.kevin Abel wrote:. . . I'd rather be using the class as an object. . . .
kevin Abel wrote:I will look for an example of it.
I would prefer, “I want to instantiate the Dog class to make [one word removed] an object.” Class with a capital C might mean this.kevin Abel wrote:. . . I want to instantiate the Dog Class to make it an object. The object will reside inside an element of the myDogs array. . . .
kevin Abel wrote:
It worked.
So there I was, trapped in the jungle. And at the last minute, I was saved by this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
|