📄 stringconversedemo.java
字号:
package chapter8;
public class StringConverseDemo {
public static void main(String[] args) {
// other to string
int x1 = 11;
String s1 = String.valueOf(x1);
System.out.println("the string of x1 is " + s1);
s1 = Integer.toString(x1);
System.out.println("the string of x1 is " + s1);
Integer x2 = new Integer(12);
String s2 = x2.toString();
System.out.println("the string of s2 is " + s2);
// string to other
Float f1;
String s3 = "1.1";
f1 = Float.parseFloat(s3);
System.out.println("the number of s3 is " + f1);
Integer x3;
String s4 = "5";
x3 = Integer.valueOf(s4);
System.out.println("the number of s4 is " + x3);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -