使用instanceof 关键字可以判断类型

解决方案 »

  1.   

    我也不知道你到底要问什么,不过关于读数组变量的例题我可以给你写一个,希望对你有所
    帮助,写的不好还请见晾!
    class HalfDollars {
          public static void main(String[] args) {
                int[] denver = {100,200,300};
                int[] phil = new int[denver.length];
                int[] total = new int[denver.length];
                int avge;            phil[0] = 1;
                phil[1] = 2;
                phil[2] = 3;            total[0] = denver[0] + phil[0];
                total[1] = denver[1] + phil[1];
                total[2] = denver[2] + phil[2];
                avge = (total[0] + total[1] + total[2])/3;            System.out.println(total[0]);
                System.out.println(total[1]);
                System.out.println(total[2]);
                System.out.println(avge);
        }
    }
      

  2.   

    你可以用Integer.parseInt()这个方法,得到整数值,或者用相关的流,取得整数,你去找找相关流的资料!
      

  3.   

    没错。
    和c不一样,java中从System.in读入的都是字符串,你必须用Integer.parseInt() 转换成数字。String num = br.readLine();
    int a = Integer.parseInt(num);