标签:
public class Person { private int age; private String name; public Person(int age, String name) { this.age = age; this.name = name; } public int getAge() { return age; } public void setAge(int age) { this.age = age; } public String getName() { return name; } public void setName(String name) { this.name = name; } @Override public String toString() { return "Person{" + "age=" + age + ", name=‘" + name + ‘\‘‘ + ‘}‘; } @Override protected void finalize() throws Throwable { System.out.println("当前对象被回收了,"+this); super.finalize(); } }
public class SystemDemo01 { public static void main(String[] args) { Person p = new Person(60,"赵雅芝"); System.out.println(p); p = null; System.gc(); } }
public class SystemDemo02 { public static void main(String[] args) { System.out.println("I love China"); System.exit(0); System.out.println("I love you"); } }
public class SystemDemo03 { public static void main(String[] args) { long start = System.currentTimeMillis(); for (int x = 0; x < 100000; x++) { System.out.println("hello:" + x); } long end = System.currentTimeMillis(); System.out.println("共耗时:" + (end - start) + "毫秒"); } }
public class SystemDemo04 { public static void main(String[] args) { int[] arr1 = {11,22,33,44,55}; int[] arr2 = {5,6,7,8,9,10}; System.arraycopy(arr1,1,arr2,2,2); System.out.println(Arrays.toString(arr1)); System.out.println(Arrays.toString(arr2)); } }
标签:
原文地址:http://www.cnblogs.com/yangyquin/p/5023983.html