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

How Java handles arguments of a class type.

=====suppose such a method:
public static void openFile(String fileName, PrintWriter stream) throws FileNotFoundException
{
   stream = new PrintWriter(fileName);
}
=====then we want to use it this way:
PrintWriter toFile = null;
try
{
   openFile("data.txt", toFile);
}
*****After this code is executed, the value of toFile is still null. The file that was opened in the method openFile went away when the method ended. The problem has to do with how Java handles arguments of a class type.
"These arguments are passed to the method as memory addresses that cannot be changed. The state of the object at the memory address normally can be changed, but the memory address itself cannot be changed"!


Ïà¹ØÎĵµ£º

JavaÍøÕ¾1

http://www.onjava.com
    O'ReillyµÄJavaÍøÕ¾. ÿÖܶ¼ÓÐÐÂÎÄÕÂ
http://java.sun.com
    ¹Ù·½µÄJava¿ª·¢ÕßÍøÕ¾ - ÿÖܶ¼ÓÐÐÂÎÄÕ·¢±í
http://www.developer.com/java
    ÓÉGamelan.com ά»¤µÄJava¼¼ÊõÎÄÕÂÍøÕ¾
http://www.java.net
  &nb ......

java 23ÖÖÉè¼ÆÄ£Ê½Öг£ÓõľÅÖÖ

1 Factory Pattern£¨¹¤³§Ä£Ê½£©
¡¡¡¡ÉϰñÀíÓÉ£º½«³ÌÐòÖд´½¨¶ÔÏóµÄ²Ù×÷£¬µ¥¶À³öÀ´´¦Àí£¬´ó´óÌá¸ßÁËϵͳÀ©Õ¹µÄÈáÐÔ£¬½Ó¿ÚµÄ³éÏ󻯴¦Àí¸øÏ໥ÒÀÀµµÄ¶ÔÏó´´½¨ÌṩÁË×îºÃµÄ³éÏóģʽ¡£
¡¡¡¡2 Facade Pattern
¡¡¡¡ÉϰñÀíÓÉ£º½«±íÏÖ²ãºÍÂß¼­²ã¸ôÀ룬·â×°µ×²ãµÄ¸´ÔÓ´¦Àí£¬ÎªÓû§Ìṩ¼òµ¥µÄ½Ó¿Ú£¬ÕâÑùµÄÀý×ÓËæ´¦¿É¼û¡£ÃÅÃæÄ£Ê½ºÜ¶ ......

java post get Á¬½ÓÍøÒ³

postºÍgetµÄÇø±ð£º
getÊÇͨ¹ýURLÏò·þÎñÆ÷µÝ½»Êý¾Ý£¬¼´Ìá½»µÄÏà¹ØÐÅÏ¢°üº¬ÔÚµØÖ·À¸µÄURLÖÐ
postÌá½»ºóµØÖ·À¸²»±ä
¿ÉÒÔͨ¹ýJava.net.URLEncoder½«ÖÐÎÄ×Ö·û±äΪ¿ÉÒÔ¼ÓÔÚURLÖÐÓÃÓÚ²éѯµÄ±àÂ룬ÏàÓ¦µÄ£¬Java.net.URLDecoderÓÃÓÚÏà¹ØµÄ½âÂë
Apache¿ªÔ´×éÖ¯ÖеÄhttpclient£¬ËüÁ¥ÊôÓÚJakartaµÄcommonsÏîÄ¿£¬×¨ÃÅÉè¼ÆÀ´¼ò»¯HTTP¿ ......

javaÈÕÆÚ

Date ---->String
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String date = sdf.fomat(new Date());

String ---->Date
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Date date = sdf.parse("2010-03-16");

ÈÕÆÚ±È½Ï´óС£¬Õâ¾ÍÓõ½ÁËDateÀàÖеÄbefore()ºÍafter()·½· ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ