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.
2 Antworten
+ 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.
0
How do i go about initializing Guielement?