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

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

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

瀏覽:80日期: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
主站蜘蛛池模板: 中文三级视频 | 免费观看一级特黄欧美大片 | 国产精品一区在线观看你懂的 | 伊人久久影院 | 中国产一级毛片 | 久久黄色大片 | 美女久久久久久 | 青青青国产依人精品视频 | 一级片黄色片 | 免费在线观看黄视频 | 三级全黄在线观看www桃花 | 午夜插插 | 五月天丁香花婷婷视频网 | 日韩爽爽爽视频免费播放 | 欧美日韩性视频一区二区三区 | 日本一级作爱片在线观看 | 精品毛片免费看 | 国产v精品成人免费视频71sao | 日韩欧美视频在线播放 | 国产的老妇人 | 一级片网站在线观看 | 欧美.成人.综合在线 | 麻豆黄色 | 国产成人综合亚洲欧美在线n | 国产成人在线播放视频 | 久久6国产| 久草在线视频网站 | 成人欧美一区二区三区视频不卡 | 日本久久视频 | 免费人成网址在线观看国内 | 国产精品久久久天天影视香蕉 | 九九黄色| 欧美蜜桃臀在线观看一区 | 丝袜 亚洲 另类 欧美 变态 | 国产亚洲精品视频中文字幕 | 国产欧美日韩精品专区 | 国产日韩欧美在线 | 日韩电影中文字幕在线网站 | 六月丁香婷婷天天在线 | 黄免费观看 | 国产换爱交换乱理伦片的功能 |