java各种数字类型与字符串型的转换

上传人:cn****1 文档编号:504343853 上传时间:2022-10-22 格式:DOC 页数:3 大小:12.50KB
返回 下载 相关 举报
java各种数字类型与字符串型的转换_第1页
第1页 / 共3页
java各种数字类型与字符串型的转换_第2页
第2页 / 共3页
java各种数字类型与字符串型的转换_第3页
第3页 / 共3页
亲,该文档总共3页,全部预览完了,如果喜欢就下载吧!
资源描述

《java各种数字类型与字符串型的转换》由会员分享,可在线阅读,更多相关《java各种数字类型与字符串型的转换(3页珍藏版)》请在金锄头文库上搜索。

1、java各种数字类型与字符串型的转换各种数字类型转换成字符串型:法一:String s = String.valueOf( value); / 其中 value 为任意一种数字类型。法二:String aa = 1+;字符串型转换成各种数字类型:String s = 169;byte b = Byte.parseByte( s );short t = Short.parseShort( s );int i = Integer.parseInt( s );long l = Long.parseLong( s );Float f = Float.parseFloat( s );Double d =

2、 Double.parseDouble( s );数字类型与数字类对象之间的转换:byte b = 169;Byte bo = new Byte( b );b = bo.byteValue();short t = 169;Short to = new Short( t );t = to.shortValue();int i = 169;b = bo.byteValue();short t = 169;Short to = new Short( t );t = to.shortValue();int i = 169;Integer io = new Integer( i );i = io.intValue();long l = 169;Long lo = new Long( l );l = lo.longValue();float f = 169f;Float fo = new Float( f );f = fo.floatValue();double d = 169f;Double dObj = new Double( d );d = dObj.doubleValue();

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 建筑/环境 > 建筑资料

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号