+ 1

Why are some variables declared outside the class and others in the block of code known as void main()?

why do some variable become declared outside of the class and some with the block of code of the void main()?

14th Mar 2017, 8:59 AM
DoubleVermine
DoubleVermine - avatar
1 Antwort
+ 1
Because the variables outside are global variables and you have access in the whole class of them. The variables in the block are local variables and you have only access in the block.
14th Mar 2017, 10:03 AM
Max_N
Max_N - avatar