What is meant by the assignment here and why is this not an initialization?
I have this example here:
int methode() { int h = 47; // Hilfsvariable for (int i = 1; i <= 10; i++) { ...... h = h + c; || Zuweisung, aber keine Initialisierung } return h ]
I got this example from my class. Initialization means the first value assignment. But it is not used in the
int h = 47
already initialized, ie the variable h is assigned the value 47?
I think I misunderstood something. Please enlighten me, I need an answer.
Thanks everyone for help in advance.
PS: I am a beginner in Java.
Yeah, that's right. And later a new value will be assigned.
No, local variables are not implicitly initialized.
Right. With the line "int h = 47", the variable is defined and simultaneously initialized. Later, an assignment to another value only takes place, but no renewed initialization.
Yes, initialization means that the memory is reserved; that means where the memory is reserved in the program (if you do "int h" eg).
This means "int h=47;" is an initialization, since here the first time hears from the variable h in the program. Only new assignments follow in the loop.