java中的范围变量

时间:2016-11-13 06:28:25

标签: java

我有一个代码, 我需要在我评论的海盗点找到范围变量。 但我怀疑args是否属于范围变量?

这是代码:

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
   }
}

1 个答案:

答案 0 :(得分:0)

SELECT pD.programmeID pD.programmeRequirement FROM programmeDetail pD INNER JOIN applicant appl ON pD.programmeID = appl.programmeID GROUP BY pd.programmeID HAVING COUNT(*) < 20 的范围在main()中。您可以查看thisargs是一个方法参数,因此仅在main()中有效,如果这是您要求的。