java´«Öµ»¹ÊÇ´«ÒýÓÃ
×î½üÒ»Ö±ÔÚ¿´primer c++£¬º¯ÊýÒ»Õ¶Ôc++º¯ÊýÖ®¼ä´«µÝ²ÎÊýÓÐÏêϸµÄ½²½â£¬´«Öµ¡¢´«Ö¸ÕëºÍ´«ÒýÓõÄÓ¦ÓÃÓëÇø±ð¶¼½²µÃºÜÇå³þ£¬
ÒÔÇ°Ò»Ö±ÓÃjava£¬ÓÉÓÚjavaûÓÐÖ¸Õ룬µ±Ê±Ò²Ã»ÓÐÒýÓÃÕâ¸ö¸ÅÄËùÒÔûÓжÔjava²ÎÊýµÄ´«µÝÓйý¶àµÄ˼¿¼£¬ÏÖÔÚ¸ãÇå³þÁËc++
´«µÝ²ÎÊýµÄ»úÖÆ£¬×ÔÈ»¾Í»á¸újava½øÐжԱȣ¬¾¿¾¹java´«µÄÊÇʲô¶«Î÷£¿
Java´úÂë
public static void test(Pass passA); {
passA = null;
}
¿´¿´, ¶ÔpassAÓÐʲôӰÏ죿
ºÁÎÞ×÷Ó᣺¯Êýµ÷ÓóöÀ´ºó£¬passA»¹ÊÇÔÀ´µÄÖµ£¬²»»á±ä³ÉNull.
µ«ÊÇ£¬ÄãµÄ´úÂë¶Ô passA½øÐÐÁ˲Ù×÷ passA.a £¬¸Ä±äÁËpassAµÄ³ÉÔ±±äÁ¿¡£
Õâ¸ö³ÉÔ±±äÁ¿ÊÇÒ»¸öÕæʵָÏòString µÄ µØÖ·£¬µ±È»Äܹ»±»¸Ä±ä¡£
Õâ¾ÍÊDzÙ×÷ (.) ºÍ ¸³Öµ (=) µÄÇø±ð¡£
ÕâÊÇ¶Ô ³ÉÔ±±äÁ¿ a µÄ ¸³Öµ¡£ÕæÕý¸Ä±äÁ˳ÉÔ±±äÁ¿ a µÄÖµ¡£
×¢Ò⣬ÕâÀï´«µÝµÄ²ÎÊýÊÇ passA, ¶ø²»ÊÇ a.
ËùÒÔ£¬passA ±»¸´ÖÆÁËÒ»·Ý¡£passA µÄÕâ¸ö¸±±¾µÄ a ±äÁ¿»¹ Ö¸Ïò ÔÀ´µÄ passA µÄ a ±äÁ¿¡£
JavaÖеēÒýÓÔÊÇÖ¸·ÇÔÉúÀàÐ͵ıäÁ¿µÄÖµ±£´æµÄÊǶÔÒ»¸ö¶ÑÉ϶ÔÏóµÄÒýÓá£
JavaÈκÎʱºò¶¼ÊÇ´«ÖµµÄ£¬Ö»²»¹ý¸ÃÖµµÄÓïÒåÓÐËù²»Í¬°ÕÁË
1¡¢¶ÔÏóÊÇ°´ÒýÓô«µÝµÄ
2¡¢Java Ó¦ÓóÌÐòÓÐÇÒ½öÓеÄÒ»ÖÖ²ÎÊý´«µÝ»úÖÆ£¬¼´°´Öµ´«µÝ
3¡¢°´Öµ´«µÝÒâζ×ŵ±½«Ò»¸ö²ÎÊý´«µÝ¸øÒ»¸öº¯Êýʱ£¬º¯Êý½ÓÊÕµÄÊÇÔʼֵµÄÒ»¸ö¸±±¾
4¡¢°´ÒýÓô«µÝÒâζ×ŵ±½«Ò»¸ö²ÎÊý´«µÝ¸øÒ»¸öº¯Êýʱ£¬º¯Êý½ÓÊÕµÄÊÇÔʼֵµÄÄÚ´æµØÖ·£¬¶ø²»ÊÇÖµµÄ¸±±¾
дµÄû´í£¬µ«ÊÇÎÄ×ÖÌ«¶à£¬µÚ¶þÌõ¾ÍÒѾ°ÑÈËŪºýÍ¿ÁË£¬µÃ×Ðϸ¿´Íê4Ìõ²ÅÇå³þ¡£¶øÇÒ¶ÔStringÀàÐ͵ÄÒÉ»óûÓнâ¾ö¡£
Èý¾ä»°×ܽáһϣº
1.¶ÔÏó¾ÍÊÇ´«ÒýÓÃ
2.ÔʼÀàÐ;ÍÊÇ´«Öµ
3.StringÀàÐÍÒòΪûÓÐÌṩ×ÔÉíÐ޸ĵĺ¯Êý£¬Ã¿´Î²Ù×÷¶¼ÊÇÐÂÉú³ÉÒ»¸öString¶ÔÏó£¬ËùÒÔÒªÌØÊâ¶Ô´ý¡£¿ÉÒÔÈÏΪÊÇ´«Öµ¡£
ÔÚÍøÉϲéÁËһϣ¬»¹ÊÇÍâ¹úÈ˽âÊ͵ñȽÏÇå³þ£º
Does Java pass by reference or pass by value?
Why can't you swap in Java?
By Tony Sintes, JavaWorld.com, 05/26/00
Q:If Java uses the pass-by reference, why won't a swap function work?
A:Your question demonstrates a common error made by Java language newcomers. Indeed, even seasoned veterans find it difficult to keep the terms straight.
Java does manipulate objects by reference, and all object variables are references. However, Java doe
Ïà¹ØÎĵµ£º
³ÌÐòÉè¼ÆÊǽâ¾öÎÊÌâ˼·µÄ¾ßÌ廯.¾ÍÏñ½¨ÔìÒ»×ù·¿×ÓÒ»Ñù£¬ÓÃʲôÑùµÄ²ÄÁÏ,½¨Ôìʲô·ç¸ñµÄ½¨Öþ,¾ßÌåÿ¸öλÖÃÊÇʲô... ²»Í¬µÄ½¨Öþʦ»áÓв»Í¬µÄ·½·¨. ¶ø°ÑÍê³ÉijһÌض¨ÎÊÌâµÄ½â¾ö˼·¹æ·¶Ò»Ï ¾Í¿ÉÒÔ³Æ×÷ΪһÖÖÉè¼Æģʽ.
³ÌÐòÉè¼ÆÖÐÉè¼ÆģʽΪÎÒÃÇÔÚijһÎÊÌâÓòÌṩÁËÒ»ÖÖÁ¼ºÃµÄʵÏÖ·½·¨²Î¿¼£¬¿ÉÒÔ´ó´óʵÏÖ¸´Óú͸ßЧ¡£
ÏÂÃæÎ ......
ºÜ¼òµ¥µÄСÀý×Ó£¬ÊʺϳõѧÕßÀí½â
1£¬JavaFlex.java
package flex;
public class JavaFlex {
public String helloJavaFlex(String name) {
return name;
}
}
2£¬remoting-config.xml
<?xml version="1.0" encoding="UTF-8"?>
<service id="remoting-service" class="flex.messaging.services.Remo ......
package org.rut.util.algorithm.support;
import org.rut.util.algorithm.SortUtil;
/**
* @author treeroot
* @since 2006-2-2
* @version 1.0
*/
public class InsertSort implements SortUtil.Sort{
/* (non-Javadoc)
* ......
×òÌì¿´µ½ÕâÑùһƪÌû×Ó£¬ÌÖÂÛÀà¼ÓÔØ˳ÐòµÄ£¬Ò²¿ÉÒÔ˵Êdzõʼ»¯Ë³ÐòµÄ£¬½ñÌìÔçÉÏÕÒ²»µ½ÁË£¬±¾À´Ïë»Ø¸´µÄ£¬ÏÖÔÚ×Ô¼ºÐ´²©¿Í»Ø¸´ÁË£¬ºÇºÇ
public class Singleton {
private static Singleton obj = new Singleton();
public static int counter1 ;
public static int counter2 = 0;& ......