lx3_22.java
来自「jbuilder2005」· Java 代码 · 共 20 行
JAVA
20 行
//lx3_22.java
public class lx3_22{
public static void main(String args[]) {
char chars1[] = {'a', 'b', 'c'};
char chars2[] = {'a', 'b', 'c', 'd'};
String s1 = new String();
System.out.println("s1:" + s1);
String s2 = new String(chars1);
System.out.println("s2:" + s2);
String s3 = new String(chars2, 1, 3);
System.out.println("s3:" + s3);
byte bytes[] = {99, 100, 101}; //使用ASCII码生成字符
String s4 = new String(bytes);
System.out.println("s4:" + s4);
String s5 = new String("中国");
System.out.println("s5:" + s5);
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?