int ---> String
例:int i = 8;
    String s = i + "";String ---> int
例:
    String s = "8";
    int i = Integer.parseInt(s);

解决方案 »

  1.   

    int->String:
    int a=3;
    String b=""+a;String->int
    String s="123";
    int a=(new Integer()).parseInt(s);
      

  2.   

    int->String
    int a=3;
    String b=Integer.toString(a);
      

  3.   

    //int --> string
    int i= 123456789;
    String s = String.valueOf(i);//方法1
    s = Integer.toString(i);//方法2
    s = ""+i;//方法3//string --> int
    String str = "123456789";
    int j = Integer.parseInt(str);//方法1
    j = Integer.valueOf(str);//方法2
    j = Integer.valueOf(str,10);//方法3
      

  4.   

    同意netkid(酸菜鱼)。
    建议不要这样写int a=(new Integer()).parseInt(s);
    又麻烦又浪费内存,不好!
    对于一个非常大的整数,那就用java.math.BigInteger吧
    String->int
    String s="123……999";
    int a=BigInteger.valueOf(s).intValue();//不过被窄化了,int只放得下低32位的