Scope variable in java -
i have code, need find scope variable @ piratical point have commented. have doubt doesargs
comes under scope variable?
here code:
public class helloworld { public static int foo(int num) { int other_num = 2; // num , other_num return num % other_num; } public static void main(string[] args) { int odd = 0; int x = 13; (int value = 0; value < x; value++) { // value , odd , x boolean local_odd = false; int r = foo(value); if (r == 1) { // value , odd , x , local_odd, r local_odd = true; } else { int div = value/2; system.out.println(div +" divides "+ value); // value , odd , x , local_odd, r , div } if (local_odd) { odd++; } } system.out.println(odd+" odd numbers smaller "+x); // odd , x } }
the scope of args
in main(). can check this out. args
method parameter therefore valid in main(), if asking.
Comments
Post a Comment