Java???????????JVM???????????
???????????? ???????[ 2013/4/26 10:57:39 ] ????????
????1??Java?????д????????5????????
???????Jvm????????????????????????????£???Java?У???????5??????????????
????1??????????new???ù?????????Java????eg??String str = new String("hello");
????2?????Class?????newInstance()???????ù?????????Java????eg??Class.forName("com.mysql.jdbc.Driver").newInstance();
????3?????Java??????л??????IO???л??Java????eg??
package test;
import java.io.Serializable;
public class Person implements Serializable {
static final long serialVersionUID = 1L;
String name; // ????
public Person() {}
public Person(String name) {
super();
this.name = name;
}
}
package test;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
public class ObjectIo {
public static void main(String[] args) throws Exception {
Person p = new Person("С??");
FileOutputStream fos = new FileOutputStream("d:/objectIoTest.dat");
ObjectOutputStream oos = new ObjectOutputStream(fos);
oos.writeObject(p);
oos.flush();
oos.close(); //??????ж?????????漸?????Java??????л??????IO???л??Java?????????
//????????????Java??????л??????IO???л??Java????
FileInputStream fis = new FileInputStream("d:/objectIoTest.dat");
ObjectInputStream ois = new ObjectInputStream(fis);
Person person = (Person) ois.readObject();
System.out.println("??????? ?? " + person.name);
}
}
???????н????
????4?????Java????????clone()????????????μ?Java????eg??
package test;
/**
* ???????Cloneable??????????дclone()????
* @ClassName: Base
* @author С??
* @date 2013-3-28
*/
public class Base implements Cloneable{
int i = 20;
@Override
protected Object clone() throws CloneNotSupportedException {
return super.clone();
}
}
package test;
public class CloneTest {
public static void main(String[] args) throws Exception {
Base b = new Base();
Base c = (Base) b.clone();
System.out.println("b??c??????????? " + (c == b));
}
}
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11