scope of variables java
Posted
by
qxc
on Stack Overflow
See other posts from Stack Overflow
or by qxc
Published on 2012-06-26T21:12:43Z
Indexed on
2012/06/26
21:15 UTC
Read the original article
Hit count: 118
java
Is a variable inside the main, a public variable?
public static void main(String[] args) {
.........
for(int i=0;i<threads.length;i++)
try {
threads[i].join();
} catch (InterruptedException e) {
e.printStackTrace();
}
long time=0;
....
}
i and time are they both public variables?
Of course if my reasoning is correct, also any variable belonging to a public method should be considered public.. am i right?
Thanks
© Stack Overflow or respective owner