-3
我有一個代碼, 我們需要找到範圍變量在我已經評論過的piratical點。 但我懷疑args
是否在範圍變量?java中的範圍變量
這裏是代碼:
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;
for (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 than "+x);
// odd , x
}
}
你的問題並不清楚和適當。請詳細說明 – Rehman
對不起,但是_「在角度寫下範圍變量」_是不可理解的。 「Piratical」意思是「與海盜有關」,這可能不是你想要的。 –
「範圍變量」表示什麼?海事組織是無稽之談。每個變量_has_的範圍在可見和有效的地方。 – Heri