A股上市公司传智教育(股票代码 003032)旗下技术交流社区北京昌平校区

 找回密码
 加入黑马

QQ登录

只需一步,快速开始

© liyeming 中级黑马   /  2016-1-8 23:31  /  567 人查看  /  2 人回复  /   0 人收藏 转载请遵从CC协议 禁止商业使用本文

Stringint类型的相互转换
A:int -- String
      *a:""进行拼接
      *b:public static String valueOf(int i)
      * c:int --Integer -- String(Integer类的toString方法())
Integer i2 = new Integer(i);
String s3 = i2.toString();
      * d:publicstatic String toString(int i)(Integer类的静态方法)
String s4 = Integer.toString(i);
System.out.println(s1);
B:String -- int
      * a:String-- Integer -- int
String s = "200";
Integer i3 = new Integer(s);
int i4 = i3.intValue();
      *public static int parseInt(String s)
String s = "200";
int i5 = Integer.parseInt(s);

2 个回复

倒序浏览
小五哥 来自手机 中级黑马 2016-1-8 23:36:47
沙发
这头都看晕了
回复 使用道具 举报
顶贴,暖贴,不过如果把注释改成常用的//会不会看上去美观一些?
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 加入黑马