成人视屏在线观看-国产99精品-国产精品1区2区-欧美一级在线观看-国产一区二区日韩-色九九九

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

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

瀏覽:96日期: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
主站蜘蛛池模板: 欧美成a人片在线观看久 | 99精品小视频 | 亚洲午夜精品久久久久久抢 | 国产视频软件在线 | 乱人伦中文视频在线 | 手机国产日韩高清免费看片 | 国产高清专区 | 久久国产亚洲精品 | 欧美午夜精品久久久久免费视 | 岛国在线免费观看 | 99在线精品免费视频 | 99久久精品国产免看国产一区 | 欧美成人三级网站 | 9cao在线精品免费 | 韩国一级永久免费观看网址 | 中文字幕一级毛片 | dy888午夜国产午夜精品 | 欧美三级毛片 | 最新亚洲精品国自产在线 | 亚洲一区二区视频 | 亚洲视频中文字幕在线 | 国产裸体美女视频全黄 | 国产成人精品亚洲一区 | 国产网站黄| 亚洲午夜精品久久久久久抢 | 在线看国产 | 久久99精品视香蕉蕉 | 福利91| 欧美精选在线 | 黄色美女视频免费 | 欧美手机手机在线视频一区 | 精品视频免费在线观看 | 亚洲另类视频在线观看 | 日韩精品一区二区三区视频 | 99国产精品免费观看视频 | 波多野结衣在线中文 | 日韩国产在线播放 | 男女男精品视频免费观看 | 夜色1网站 | 国产一区二区日韩欧美在线 | 在线观看的黄网 |