Henry Wong wrote:
Java statements, that are not declarations, must be in a constructor, initializer, or method. Java doesn't just allow you to place statements anywhere.
Henry
Fergus Flanagan wrote:
Henry Wong wrote:
Java statements, that are not declarations, must be in a constructor, initializer, or method. Java doesn't just allow you to place statements anywhere.
So why does this work....
Henry Wong wrote:
Fergus Flanagan wrote:
Henry Wong wrote:
Java statements, that are not declarations, must be in a constructor, initializer, or method. Java doesn't just allow you to place statements anywhere.
So why does this work....
That compiles because that line is a declaration. Please read my response again.
Henry
All things are lawful, but not all things are profitable.
Henry Wong wrote:
As an FYI, my last response this morning, was very terse, because I was literally shutting down my computer, on the way out the door, in order to pick up a few relatives, and to do a bunch load of errands... Anyway, I just got back, and noticed that I offended the OP.
Apologies for any offense, it was really not what I intended...
Henry
At the risk of looking like an anally‑retentive pedant, the second piece of code is declaration and initialisation together (as Knute has already said). Instantiation means something different. You need to be careful and fussy and pedantic with such jargon; if you use the jargon right all other Java® programmers will know immediately or sooner exactly what you mean.Fergus Flanagan wrote:. . .
You see I've always thought a declaration was
And instantiating as..
. . .
I think that was a fair assumption to make on the part of a beginner.
Campbell Ritchie wrote:
At the risk of looking like an anally‑retentive pedant, the second piece of code is declaration and initialisation together (as Knute has already said). Instantiation means something different. You need to be careful and fussy and pedantic with such jargon; if you use the jargon right all other Java® programmers will know immediately or sooner exactly what you mean.Fergus Flanagan wrote:. . .
You see I've always thought a declaration was
And instantiating as..
. . .
I think that was a fair assumption to make on the part of a beginner.
And you should never assume anything, because every now and again people assume the wrong thing and that starts a long series of disasters.
Instantiation means creating an object from the class, which can also be called instantiating the class. That object is called an instance of the class.Fergus Flanagan wrote:. . . . Instantiation without looking it up is used to describe what happens to objects I believe.
Campbell Ritchie wrote:
Instantiation means creating an object from the class, which can also be called instantiating the class. That object is called an instance of the class.Fergus Flanagan wrote:. . . . Instantiation without looking it up is used to describe what happens to objects I believe.
Campbell Ritchie wrote:
Instantiation means creating an object from the class, which can also be called instantiating the class. That object is called an instance of the class.Fergus Flanagan wrote:. . . . Instantiation without looking it up is used to describe what happens to objects I believe.
Did you see how Paul cut 87% off of his electric heat bill with 82 watts of micro heaters? |