这样就能得到 ^_^
int x = Interger.parseInt("1") ;

解决方案 »

  1.   

    错了 hehe  
    int x = Integer.parseInt("1") ;
      

  2.   

    int x = (new Integer("1")).intValue();
        也可以
      

  3.   

    int x = Integer.parseInt("1") ;可是我这么写,得到的结果是x=0,我想要1啊
      

  4.   

    int x = Integer.parseInt("1");
    System.out.println(x + "*****");
    我试过了,结果是1呀!
      

  5.   

    int x = Interger.parseInt("1") ;
    为何x=0?怎么样转换才能得到string的值你要1你还是“1”
      

  6.   

    int x = Integer.parseInt("1");
    System.out.println(x + "*****");
    我试过了,结果是1呀!----
    晕,难道我看错了,我记得我明明返回一个0的呀,回去我在看看,先这样吧
      

  7.   

    我把一些常用的转换写到工具类了,供你参考:
      public static int parseInt(String param) {
        int i = 0;
        try {
          i = Integer.parseInt(param);
        }
        catch (Exception e) {
          i = (int) parseFloat(param);
        }
        return i;
      }   public static long parseLong(String param) {
        long l = 0;
        try {
          l = Long.parseLong(param);
        }
        catch (Exception e) {
          l = (long) parseDouble(param);
        }
        return l;
      }   public static float parseFloat(String param) {
        float f = 0;
        try {
          f = Float.parseFloat(param);
        }
        catch (Exception e) {
          //
        }
        return f;
      }   public static double parseDouble(String param) {
        double d = 0;
        try {
          d = Double.parseDouble(param);
        }
        catch (Exception e) {
          //
        }
        return d;
      }   /**
       * Parse a string to boolean.
       * @param param string to parse
       * @return boolean value, if param begin with(1,y,Y,t,T) return true,
       * on exception return false.
       */
      public static boolean parseBoolean(String param) {
        if (nullOrBlank(param))
          return false;
        switch (param.charAt(0)) {
          case '1':
          case 'y':
          case 'Y':
          case 't':
          case 'T':
            return true;
        }
        return false;
      }