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"!
Ïà¹ØÎĵµ£º
Abstract
ÔÚ¿ª·¢ÖУ¬Èç¹ûij¸öʵÀýµÄ´´½¨ÐèÒªÏûºÄºÜ¶àϵͳ×ÊÔ´£¬ÄÇôÎÒÃÇͨ³£»áʹÓöèÐÔ¼ÓÔØ»úÖÆ£¬Ò²¾ÍÊÇ˵ֻÓе±Ê¹Óõ½Õâ¸öʵÀýµÄʱºò²Å»á´´½¨Õâ¸öʵÀý£¬Õâ¸öºÃ´¦ÔÚ
µ¥ÀýģʽÖеõ½Á˹㷺ӦÓá£Õâ¸ö»úÖÆÔÚsingle-threaded»·¾³ÏµÄʵÏַdz£¼òµ¥£¬È»¶øÔÚmulti-threaded» ......
ÄÜͨ¹ýJavaÀ´²Ù×÷Word»òÕßExcelµÄapi£¬¾ÝÎÒËùÖªµÄÓÐÕâЩ£¬¶¼¿¼²ìÁËһϣ¬¿ªÔ´µÄ³ýÁËOpenofficeºÍofficewriter¶ÔWordµÄ±í¸ñÓкõÄÖ§³ÖÍ⣬ÆäËû¶¼ºÜ²»×¨Òµ£¬»òÕß²»Ö§³Ö¡£
jacob http://sourceforge.net/projects/jacob-project/
JACOB is a JAVA-COM Bridge that allows you to call COM Automation components from Java. ......
postºÍgetµÄÇø±ð£º
getÊÇͨ¹ýURLÏò·þÎñÆ÷µÝ½»Êý¾Ý£¬¼´Ìá½»µÄÏà¹ØÐÅÏ¢°üº¬ÔÚµØÖ·À¸µÄURLÖÐ
postÌá½»ºóµØÖ·À¸²»±ä
¿ÉÒÔͨ¹ýJava.net.URLEncoder½«ÖÐÎÄ×Ö·û±äΪ¿ÉÒÔ¼ÓÔÚURLÖÐÓÃÓÚ²éѯµÄ±àÂ룬ÏàÓ¦µÄ£¬Java.net.URLDecoderÓÃÓÚÏà¹ØµÄ½âÂë
Apache¿ªÔ´×éÖ¯ÖеÄhttpclient£¬ËüÁ¥ÊôÓÚJakartaµÄcommonsÏîÄ¿£¬×¨ÃÅÉè¼ÆÀ´¼ò»¯HTTP¿ ......
ÒÔÏÂÉèÖÃWinXP¼°ÒÔÉÏÓû§£¬ÓÒ¼üµã»÷ÎҵĵçÄÔ->ÊôÐÔ->¸ß¼¶->»·¾³±äÁ¿£¬ÉèÖü´¿É¡£ÉèÖÃÍê³ÉºóÐèÖØÐÂÆô¶¯ÃüÁîÌáʾ·û²ÅÄÜÉúЧ¡£¾ßÌåÈçÏ£º
JAVA»·¾³±äÁ¿ÉèÖÃ
WindowsÏÂJAVAÓõ½µÄ»·¾³±äÁ¿Ö÷ÒªÓÐ3¸ö£¬JAVA_HOME¡¢CLASSPATH¡¢PATH¡£
JAVA_HOMEÖ¸ÏòµÄÊÇJDKµÄ°²×°Â·¾¶£¬ÈçD:\Program Files\IBM\Java50£¬ÔÚÕâ·¾¶ÏÂÄãÓ¦¸ÃÄܹ»Õ ......
package test;
/**
*
* @author openpk
*/
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Semaphore;
public class Main {
public static void main(String[] args) {
// Ï̳߳Ø
ExecutorService exec = Executors ......