package com.itheima;
public class intger_02 {
public static void main(String[] args) {
//int和string的相互转换
int number=100;
//方式一
String s1=number+"";
System.out.println(s1);
//方式二
String s2=String.valueOf(number);
System.out.println(s2);
System.out.println("-------------");
//string....转换..int类型
String s="100";
//方式1 String-----Integer
Integer i = Integer.valueOf(s);
int x = i.intValue();
System.out.println(x);
//方式2
int y = Integer.parseInt(s);
System.out.println(y);
}
}
执行结果
100
100
-------------
100
Process finished with exit code 0
标签:string,int,System,String,println,Integer,out
From: https://www.cnblogs.com/cy-xt/p/16849289.html