System.in与System.out
public static void main(String[] args) {
System.out.println(); //System.out 控制台输出语句
Scanner scanner = new Scanner(System.in); //System.in 输入语句
String i = scanner.nextLine();
System.out.println(i);
}
System.arraycopy
public static void main(String[] args) {
int[] arr = {1,2,3,4,5,6,7};
int[] arr1 = {9,8,7,6,5,4,3};
//从数组arr中的地址为2开始覆盖到arr1中的地址为3的位置 共计覆盖两位
System.arraycopy(arr,2,arr1,3,2);
System.out.println(Arrays.toString(arr1));
long l = System.currentTimeMillis();
System.out.println(l);
}
System.currentTimeMillis
public static void main(String[] args) {
//1937年7月7日到当前时间的毫秒数
long i = System.currentTimeMillis();
System.out.println(i);
long l = System.currentTimeMillis();
method();
long l1 = System.currentTimeMillis();
System.out.println("花费的时间为"+(l1-l));
System.gc();
System.exit(1);
}
public static void method(){
for (int i = 0; i < 10; i++) {
System.out.println("Hello World!");
try {
Thread.sleep(100);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
该文档只是本人学习过程中编辑存贮
如使用该文档中的内容,该文档只限于参考 如有错误还请纠正