publicclass Number {
publicvoid method1() {
int count;
}
publicvoid method2() {
int count;
}
}
The code in this example is legal and correct.
Actual names of integer variables inside method1 and method2 are unimportant, because the same thread of execution can enter either of methods, but not both at the same time.
Note: the above is true if method1 invokes method2 or vice versa.