Java¶ÔÏó¿½±´
public class Person implements Serializable {
private String name;
private int age;
private GregorianCalendar birthday;
public Person(){
}
public Person(String name, int age, GregorianCalendar birthday){
this.name = name;
this.age = age;
this.birthday = birthday;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public GregorianCalendar getBirthday() {
return birthday;
}
public void setBirthday(GregorianCalendar birthday) {
this.birthday = birthday;
}
public static void main(String[] args) {
Person p = new Person("ÕÅÈý",13,new GregorianCalendar(1985,8,1));
Person p2 = null;
try{
ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(byteOut);
oos.writeObject(p);
Ïà¹ØÎĵµ£º
Èç¹ûÄãjavaÒѾÈëÃÅÁË£¬½¨ÒéÄãÏȲ»È¥Ïë´úÂë¡£¶øÊÇÈ¥ÏëÍê³ÉÈÎÎñÒª×öµÄ²½Öè¡£ÏëºÃÁ˺óÄÄÅÂÄãÈ¥Õ³Ìù´úÂë¶¼¿ÉÒÔ¡£±à³ÌÊÇ¿¼ÑéµÄ˼ά£¬²»ÊÇд´úÂëµÄËÙ¶È£¬ºÍ¶Ô´úÂëµÄ¼ÇÒäÐÔ¡£
±à³ÌÊÇÒ»¼þ¾Ñé»î, ²»ÊÇ¿´ÊéÄܽâ¾öµÄ, ±à³ÌÖÐÓöµ½µÄÎÊÌâÇ§Ææ°Ù¹Ö, ¸ù±¾²»ÊÇÒ»±¾Êé»òÕßn±¾ÄܸøÄã½â¾öµÄ£¬±ØÐë×Ô¼ºÇ××ÔÈ¥Ìå»á
ËùÒÔ, ÕÒ±¾ÓÐʵÀýµ ......
http://hi.baidu.com/shedewang/blog/item/b4a71b254e43ce35c895599b.html
˵ÊÇÖ§³Ö1ÒÚpv/Ì죬ҲÐíÓеã¿äÕÅ£¬µ«Èç¹ûÄúÄÜÈÏÕæ¿´ÍêÏàÐÅÒ²²»»áÈÃÄúʧÍû¡£
Èç¹û´ó¼ÒÕæÏëÖ§³ÖÎÒ¡¢Ö§³ÖÖйúÈË¿ªÔ´ÏîÄ¿£¬Çë°Ñ¸ÃÎÄÌùµ½×Ô¼ºµÄ²©¿ÍÖлòÕßÊղر¾ÎÄ£¬¼ÇµÃ°üº¬ÎĵµµÄÏÂÔØµØÖ·£¡£¡£¡£¡£¡£¡£¡Ð»Ð»¡£
ÎÒ˵µÄϵͳÖ÷ÒªÊǹ¹½¨ÔÚhibernateÖ®ÉÏ ......
http://www.javaworld.com/javaworld/javaqa/2000-05/03-qa-0526-pass.html
Does Java pass by reference or pass by value?
Why can't you swap in Java?
By Tony
Sintes, JavaWorld.com, 05/26/00
Print
Email
Feedback
Resources
Discuss
(76)
Digg
Reddit
SlashDot
Stumble
......
//=============================Êä³öÆæÊý
public class OddTest {
public static boolean isOdd(int i){
return i % 2 != 0; //±È½Ï i % 2 == 0;×¢£º -1%2 = -1
}
public static void main(String[] args) {
for(int i = -10; i <= 10; i++) {
System.out.println(isOdd(i));
}
}
}
// ......
1£¬intÓëbytes ת»»
intת»»³Ébytes
public
static
final
byte
[]
int2bytes
(
int
value
)
{
return
new
byte
[]
{
(
byte
)(
value
>>>
24
),
(
byte
)(
value
>>>
16
),
......