Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

java¿½±´¶ÔÏó

ÕâÊÇÎÒ¸öÈ˵ÄÀí½â£¬¼ÓÉÏÒÔÇ°¿´µÄһЩÌû×Ó£¬Óв»¶ÔµÄµØ·½£¬Çë¸ßÈËÖ¸µã¡£
1.×÷Ϊjava²ÎÊý´«µÝ¸øÒ»¸öº¯ÊýµÄ¶ÔÏ󣬳ýÁ˺ܼòµ¥µÄÈçint»òÕßbooleanµÈ¼òµ¥µÄÒÔÍ⣬´«µÝµÄ¶¼ÊÇÕâ¸ö¶ÔÏóµÄÒýÓá£
µ±ÔÚ½ÓÊÕº¯ÊýÖиıäÕâ¸ö¶ÔÏóµÄʱºò£¬Ô­À´µÄ¶ÔÏó¼´±»¸Ä±ä¡£
2.ÔÚ³õʼ»¯Ò»¸ö¶ÔÏóµÄʱºò£¬ÓÐʱºòÎÒÃÇÏ£ÍûÓÃÒ»¸öÒѾ­´æÔڵĶÔÏóÀ´¸øÁíÍâÒ»¸ö¶ÔÏó¸³Öµ£¬µ«ÊÇÖ±½ÓÓÓ£½”¸øÁíÍâÒ»¸ö
¶ÔÏó¸³ÖµµÄ»°£¬ÊÇ´íÎóµÄ£¬ÕâÑù»áʹÁ½¸ö²»Í¬µÄ¶ÔÏóÃû×ÖÖ¸Ïòͬһ¸ö¶ÔÏ󡣸ıäÆäÖÐÈκÎÒ»¸ö¶¼»áÒýÆð¸Ã¶ÔÏóµÄ¸Ä±ä¡£
ÏÂÃæÎÒÃÇʵÑéÒ»ÏÂÓÃÒ»¸ö¶ÔÏó¸øÁíÍâÒ»¸ö¶ÔÏó¸³Öµ£ºpublic class Student {
private int age;
private String name;
public Student(int age, String name) {
this.age = age;
this.name = name;
}
public void show() {
System.out.println(this.age + "" + this.name);
}

public void setAge()
{
this.age = 10;
}
}
public class test {
public static void main(String as[]) {
Student s = new Student(1, "name");
Student temp = s;
temp.setAge();
temp.show();
s.show();
}
}

ÉÏÊö´úÂëÔËÐнá¹ûÈçÏ£º
10name
10name
½á¹û±íÃ÷£¬ËäÈ»ÊÇÓÃstudentµÄ¶ÔÏós¸øtemp¸³Öµ£¬µ«ÊÇtempºÍsÊÇÖ¸Ïòͬһ¸ö¶ÔÏóµÄ£¬tempÖ¸ÏòµÄ¶ÔÏó¸Ä±äageµÄʱºò£¬sÖ¸ÏòµÄ¶ÔÏóµÄageÒ²¸Ä±äÁË¡£²»ÊÇÎÒÃÇÏ£ÍûµÃµ½µÄ¡£
ÔÚC£«£«ÖУ¬ÓÐÉ±´ºÍdz¿½±´Á½¸ö¸ÅÄjavaÖУ¬ÎÒÃÇÓÃCloneable½Ó¿ÚÀ´ÍêÈ«¸´ÖÆÒ»¸ö¶ÔÏó¡£
²Î¿¼ÏÂÃæµÄ´úÂ룺
public class BankAccount implements Cloneable {
private double balance;
public BankAccount(double ini) {
this.balance = ini;
}
protected Object clone() {
BankAccount bankAccount = null;
try {
bankAccount = (BankAccount) super.clone();
} catch (CloneNotSupportedException e) {
e.printStackTrace();
}
return bankAccount;
}
public void add(double give) {
this.balance += give;
}
public void redu(double give) {
this.balance -= give;
}
public double getBalance() {
return balance;
}
public void setBalance(double balance) {
this.balance = balance;
}
}

ÎÒÃÇÁîBankAccountʵÏÖCloneable½Ó¿Ú£¬ÊµÏÖÆ丸Àࣨ¾ÍÊÇObjectÀࣩµÄcloneº¯Êý¡£
¿´Ò»ÏÂcloneº¯ÊýµÄdoc£º
Cr


Ïà¹ØÎĵµ£º

Effective Java ѧϰ±Ê¼Ç (11)

CloneÕâ¸ö·½·¨ºÜ¼¦Àߣ¬Ô­ÒòÊÇÒòΪËüÊÇÊܱ£»¤µÄ(protected)£¬Æä¶þCloneÕâ¸ö·½·¨ÊÇ¿ÉÑ¡µÄ£¬¼´ÓпÉÄÜÀàûÓÐÌṩÕâ¸ö·½·¨¡£
cloneûÓе÷Óù¹Ô캯Êý£¬¶øÇÒÈç¹û¸¸ÀàûÓÐʵÏÖcloneµÄ»°£¬×ÓÀàÓÀÔ¶Ò²²»¿ÉÄÜÕýȷʵÏÖclone.
×ÜÖ®£¬cloneÊǸöºÜÍ·Í´µÄº¯Êý£¬Èç¹ûÒªÕýȷʵÏÖ£¬±ØÐ뿼Âǵ½É±´µÄÇé¿ö£¬·ñÔò±»¿Ë¡³öÀ´µÄ¶ÔÏó¾Í²»ÊǶÀÁ¢µÄ ......

Effective Java ѧϰ±Ê¼Ç£¨13£©

Ó°ÏìÄ£¿éÉè¼ÆºÃÓ뻵µÄÒ»¸öÖØÒªÒòËؾÍÊÇÕâ¸öÄ£¿éÊÇ·ñÒþ²ØËüµÄÄÚ²¿Êý¾ÝºÍÆäËûһЩʵÏÖϸ½Ú¡£
ÐÅÏ¢Òþ²ØµÄºÃ´¦£º·½±ã¶ÀÁ¢¿ª·¢£¬²âÊÔ£¬ÓÅ»¯£¬Ê¹Óã¬Àí½âºÍÐ޸ġ£Äܹ»Ìá¸ßϵͳ¿ª·¢ËÙ£¨ÒòΪ¸÷Ä£¿é¿ÉÒÔ²¢Ðпª·¢£©£¬Ò²ÄÜÒ×ÓÚά»¤ºÍµ÷ÊÔ£¬Ò²ÄܼõÉÙϵͳ¹¹½¨µÄ·çÏÕ¡£
ÒªÉè¼ÆÁ¼ºÃµÄÄ£¿é£¬¹æÔòºÜ¼òµ¥£¬¾ÍÒ»¾ä»°£ºÊ¹Ã¿¸öÀà»ò½Ó¿Ú¾¡Á¿²»¿É ......

Java Web µÚ¶þÌì Servlet»ù´¡

Ò»¡¢
ʲôÊÇ
Servlet
Servlet
ÔÚ
web
ÈÝÆ÷ÖÐÓÃÀ´´´½¨¶¯Ì¬ÍøÒ³Óõģ¬ÒòΪËûûÓÐ
main
·½·¨£¬ËùÒÔ
Servlet
²»ÊÇÒ»¸öÍêÕûµÄ
Java
Ó¦ÓóÌÐò¡£
¶þ¡¢
Servlet
µÄ±àд
×î»ù±¾µÄ
Servlet
Òª°üÀ¨Èý²¿·Ö£¬·Ö±ðΪ
Servlet-name
¡¢
Servlet-class
¡¢
url-pattern
¡£
Èý¡¢
Servlet API
Generi
Servlet
ÊµÏ ......

Java Web µÚÆßÌì ФÀÏ´®½²+¹ºÎﳵС½á

ͨ¹ý
½ñÌìСÀÏʦ¶Ô
Javaweb
µÄ´®½²£¬×Ô¼º×î´óÊÕ»ñÊǶÔÕû¸öjavaWebÓÐÁËÒ»¸öϵͳµÄÀí½â£¬¶ÔʵÏÖ¸÷¸ö²½ÖèµÄÔ­ÀíÓÐÁËÒ»¸öÈÚ»á¹áͨ£¬ÕûÌå֪ʶµãÒ²´®ÁªÁËÆðÀ´£¬×Ô¼ºµÄ˼ÏëÒ²´ÓÒÔÇ°µ¥´¿µÄÀûÓÃ
Java
´úÂë±àдÏÖʵÏîÄ¿³ÌÐòµ½Ó¦ÓÃÏÖÓй¤¾ß·½±ã¿ì½ÝµÄ·¢¿ª³öÏîÄ¿³ÌÐòµÄ¹ý¡£ÏÖÔڻعË֮ǰ6ÕµÄ֪ʶµãÄÚÈÝ£¬
Javaweb
¸Ð¾õÇåÎúÁ˺ܶà ......

JavaÅжÏOSÊÇlinux»¹ÊÇwindows

public class Test {
public static void main(String aa[]) {
if (System.getProperty("os.name").equals("Linux")) {
System.out.println("linux");
} else if (System.getProperty("os.name").equals("Windows XP")) {
System.out.println("win ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ