Sololearn: Learn to Code
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5
if int i is local variable declared in method there is not default value public static void main(String[] args) { int i; System.out.println(i); // error: variable i might not have been initialized }
30th Jun 2019, 7:35 PM
zemiak
+ 3
Hi Saeed Haghighi Please use proper tags with your question. It will help others finding this question to others. Happy Coding ☺
30th Jun 2019, 3:24 PM
Sachin Artani
Sachin Artani - avatar
+ 3
It's best to define your variables at declaration time.
2nd Jul 2019, 2:28 AM
Sonic
Sonic - avatar
+ 2
If you don't initialize static variables they get default. Int 0, double 0.0 and so on. https://code.sololearn.com/c5NfHaf0d8Xh/?ref=app Edit: change the print statement to see all default values.
30th Jun 2019, 2:34 PM
Denise Roßberg
Denise Roßberg - avatar
0
O i think
3rd Sep 2019, 11:26 AM
majid sadeghianpour
majid sadeghianpour - avatar