首页 > 学院 > 开发设计 > 正文

Java核心代码例程之:StringToInt.java

2019-11-18 15:16:32
字体:
来源:转载
供稿:网友

/**
 * 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);
    }
}

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表