Java核心代码例程之:StringToInt.java
2008-01-05 08:38:05 来源:WEB开发网核心提示:/** * Demo how to convert int to String and back.Similar * stuff can be done with the Float, Double, etc. classes * in java.lang ***/public class StringToInt{pu
/**
* Demo how to convert int to String and back. Similar
* stuff can be done with the Float, Double, etc. classes
* in java.lang
***/
public class StringToInt
{
public static void main(String args[]) throws Exception
{
// From String to int
String sA="123";
int iA=Integer.parseInt(sA);
// From int to String
int iB=23;
String sB = String.valueOf(iB);
}
}
更多精彩
赞助商链接