亚洲精品久久久中文字幕-亚洲精品久久片久久-亚洲精品久久青草-亚洲精品久久婷婷爱久久婷婷-亚洲精品久久午夜香蕉

您的位置:首頁技術文章
文章詳情頁

java數據類型轉換,parseXXX(String)或valueOf(String)有什么區別?

瀏覽:85日期:2023-12-08 14:01:25

問題描述

基本類型的包裝類的parseparseXXX(String)和valueOf(String)有什么區別呀?

問題解答

回答1:

JDK8源碼

/** * Returns an {@code Integer} object holding the value * extracted from the specified {@code String} when parsed * with the radix given by the second argument. The first argument * is interpreted as representing a signed integer in the radix * specified by the second argument, exactly as if the arguments * were given to the {@link #parseInt(java.lang.String, int)} * method. The result is an {@code Integer} object that * represents the integer value specified by the string. * * <p>In other words, this method returns an {@code Integer} * object equal to the value of: * * <blockquote> * {@code new Integer(Integer.parseInt(s, radix))} * </blockquote> * * @param s the string to be parsed. * @param radix the radix to be used in interpreting {@code s} * @return an {@code Integer} object holding the value * represented by the string argument in the specified * radix. * @exception NumberFormatException if the {@code String} * does not contain a parsable {@code int}. */public static Integer valueOf(String s, int radix) throws NumberFormatException { return Integer.valueOf(parseInt(s,radix));}

這里用Inteager來說明, valueOf 實際上調用了 parseInt。 parseInt方法是類Integer的靜態方法,它的作用就是將字符串轉化為整數int valueOf也是Integer類的靜態方法,它的作用是將字符串轉化為Integer對象

標簽: java
主站蜘蛛池模板: 久草在线视频网站 | 久久精品视频在线观看榴莲视频 | 国产精品久久福利网站 | 国内在线播放 | 黄色影视在线 | 91久久精品一区二区 | 国产精品麻豆视频 | 香蕉视频黄色片 | 土耳其毛片 | 点击进入毛片免费观看 | 欧美在线视频一区二区三区 | 香蕉成人啪国产精品视频综合网 | 91福利国产在线观看香蕉 | 国产精品小黄鸭一区二区三区 | 国产一国产一有一级毛片 | 俄罗斯女人与公拘i交酡 | 黑人狂躁日本妞中文字幕 | 久久久久久久免费视频 | 正在播放国产会所按摩视频 | 久久久久国产精品免费免费 | 美女一级毛片免费观看 | 三级视频欧美 | 国产一区二区三区视频在线观看 | 日本久久久久中文字幕 | 久久精品综合视频 | 在线看色片 | 91精品国产手机在线版 | 国产欧美日韩在线播放 | 国产女人在线 | 欧美一级成人影院免费的 | 军营里娇喘呻吟声乳 | 男女生性毛片免费观看 | 精品国产福利第一区二区三区 | 女女互添下身免费视频 | 俄罗斯一级毛片免费播放 | 骚色网站| 污污网站免费入口链接 | 久久精品免观看国产成人 | 91精品国产91久久久久久最新 | 青青青国产精品国产精品美女 | 日本一区精品久久久久影院 |