public class Main { public static void main(String[] args) { String s = "23"; int i = 22; // int to string String iString = Integer.toString(i); System.out.println(iString); // output: // 22 // string to int int sInt = Integer.parseInt(s); System.out.println(sInt); // output: // 23 } }
Wednesday, September 23, 2009
Java - cast int to string and string to int
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment