Java程序使用Integer.valueOf()将字符串转换为数字原始类型
Java中使用Integer.valueOf()方法将字符串转换为数字原始类型。
假设以下是我们的字符串。
String str = "989";
要将其转换为Integer基本类型,请使用Integer.valueOf()
Integer.valueOf(str)
让我们看看将字符串转换为Integer基本类型的完整示例。
示例
public class Demo { public static void main(String[] args) { String str = "989"; System.out.println(Integer.valueOf(str)); }}输出结果
989
热门推荐
10 十月简短祝福语
11 国庆中秋祝福语简短搞笑
12 官宣新年祝福语简短
13 初六开工祝福语简短
14 女儿生日祝福语说说简短
15 祝福语简短古诗词
16 直播生孩子祝福语简短
17 很暧昧的简短祝福语
18 送蛇的祝福语简短