午夜剧场伦理_日本一道高清_国产又黄又硬_91黄色网战_女同久久另类69精品国产_妹妹的朋友在线

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

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

瀏覽:166日期: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日日| 少妇高潮一区二区三区99 | 午夜www| 精品一区二区在线播放 | 一本一道精品欧美中文字幕 | 在线观看免费福利 | 国产又色又爽又黄的 | 久久国产免费 | 国产成人免费观看 | 午夜视频黄| 久久久影院 | 午夜丁香婷婷 | 麻豆久久久久久 | 操操操爽爽爽 | 四虎4hu永久免费网站影院 | 女人毛片视频 | 色吧av| 国产精品成人一区二区三区 | 亚洲性色图 | 一级欧美日韩 | 亚洲色图另类小说 | www.av.| 日韩欧美一二三 | 91破解版在线观看 | 久久亚洲区 | 自拍偷拍视频在线观看 | 国产久草视频 | 国产91av在线播放 | 久久精品视频国产 | 亚洲欧美999 | 国产探花在线观看 | 五月天av网站 | 黄色片免费网站 |