[Java] 纯文本查看 复制代码
import java.io.IOException;
public class Test06 {
public static void main(String[] args) {
System.out.println("请输入字符,按回车键结束输入:");
int c;
try {
c = System.in.read(); // 读取输入的字符
while(c != '\r') { // 判断输入的字符是不是回车
System.out.print((char) c); // 输出字符
c = System.in.read();
}
} catch(IOException e) {
System.out.println(e.toString());
} finally {
System.err.println();
}
}
}
[HTML] 纯文本查看 复制代码
public class System_arrayCopy {
public static void main(String[] args) {
char[] srcArray = {'A','B','C','D'};
char[] destArray = {'E','F','G','H'};
System.arraycopy(srcArray,1,destArray,1,2);
System.out.println("源数组:");
for(int i = 0;i < srcArray.length;i++) {
System.out.println(srcArray);
}
System.out.println("目标数组:");
for(int j = 0;j < destArray.length;j++) {
System.out.println(destArray[j]);
}
}
}
[Java] 纯文本查看 复制代码
public class System_getProperty {
public static void main(String[] args) {
String jversion = System.getProperty("java.version");
String oName = System.getProperty("os.name");
String user = System.getProperty("user.name");
System.out.println("Java 运行时环境版本:"+jversion);
System.out.println("当前操作系统是:"+oName);
System.out.println("当前用户是:"+user);
}
}