0

Understanding initialization & declaration in java.

From what I understand initializing a variable means to assign it a value? You can concatenate this when declaring like this? Public Int thisthing = 0; <~ public int thisthing is declaration & (=0) is proper initialization? Then Thisthing = (TextView) findViewByid(R. Id. Guielement); Does this mean that now i have initialized my variable of Guielement to a default value of 0? Thanks in advance.

23rd Feb 2017, 3:36 PM
Opaque Dmr
Opaque Dmr - avatar
2 odpowiedzi
+ 2
Public Int thisthing = 0; <~ public int thisthing is declaration & (=0) is proper initialization? Yes, it is! ---- Thisthing = (TextView) findViewByid(R. Id. Guielement); Assuming that thisthing is the same variable of the previous question, this is wrong. You're trying to put a "TextView" variable inside a int variable, that is not possible. You are not initializing Guielement in this case, you are only getting its value.
23rd Feb 2017, 3:41 PM
Marco Bimbati
Marco Bimbati - avatar
0
How do i go about initializing Guielement?
23rd Feb 2017, 10:38 PM
Opaque Dmr
Opaque Dmr - avatar