Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö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"!


Ïà¹ØÎĵµ£º

dz̸Java¶àÏ̵߳Äͬ²½ÎÊÌâ

¶àÏ̵߳Äͬ²½ÒÀ¿¿µÄÊǶÔÏóËø»úÖÆ£¬synchronized¹Ø¼ü×ֵı³ºó¾ÍÊÇÀûÓÃÁË·âËøÀ´ÊµÏÖ¶Ô¹²Ïí×ÊÔ´µÄ»¥³â·ÃÎÊ¡£
ÏÂÃæÒÔÒ»¸ö¼òµ¥µÄʵÀýÀ´½øÐжԱȷÖÎö¡£ÊµÀýÒªÍê³ÉµÄ¹¤×÷·Ç³£¼òµ¥£¬¾ÍÊÇ´´½¨10¸öỊ̈߳¬Ã¿¸öÏ̶߳¼´òÓ¡´Ó0µ½99Õâ100¸öÊý×Ö£¬ÎÒÃÇÏ£ÍûÏß³ÌÖ®¼ä²»»á³öÏÖ½»²æÂÒÐò´òÓ¡£¬¶øÊÇ˳ÐòµØ´òÓ¡¡£
ÏÈÀ´¿´µÚÒ»¶Î´úÂ룬ÕâÀïÎÒÃÇÔÚru ......

javaÍøÕ¾ 2

java¹úÍâÖøÃûÍøÕ¾
1. JavaµÄÀϼңº
¡¡¡¡Á´½Ó£ºwww.javasoft.com java.sun.com
¡¡¡¡¼ò½é£ºÕâÊDzéÕÒ¸÷ÖÖJava¹Ù·½×ÊÔ´µÄºÃµØ·½£¬ÎÒÃÇ¿ÉÒÔÔÚÕâÀïÏÂÔØµ½×îеÄJDK¡¢Java¹¤¾ß¡¢ÒÔ¼°JDKDOC¡£
¡¡¡¡2. EarthwebµÄ¿ª·¢ÍøÕ¾£º
¡¡¡¡Á´½Ó£ºwww.gamelan.com
¡¡¡¡¼ò½é£ºËüÊÇËùÓÐJava×ÊÔ´Õ¾µãµÄÊ¼×æ¡£
¡¡¡¡3. Java FocusÍøÕ¾£º ......

java post get Á¬½ÓÍøÒ³

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

java ·¢ËÍÓʼþʵÀý

package com.sj.main;
public class Snippet {
public static void main(String[] args){
//Õâ¸öÀàÖ÷ÒªÊÇÉèÖÃÓʼþ
MailSenderInfo mailInfo = new MailSenderInfo();
String biaoti ="ÎÒÊÇËÕ½¨£¬ÕâÊÇÎҵIJâÊÔÓʼþ";
String neirong = "ÎÒÊÇËÕ½¨ÒÔÏÂÊÇÎҵIJâÊÔÓʼþ£¬»¶Ó­´ó¼Ò½ ......

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ºÅ