Java±ÊÊÔÌ⡾ת¡¿
1.д³ö³ÌÐòÔËÐнá¹û
public
class
TestString {
public
static
void
link(String a){
a+="World"
;
}
public
static
void
main(String []args){
String a = "Hello"
;
link(a);
System.out.println(a);
}
}
´ð: ÕâµÀÌ⿼Á½¸ö·½Ãæ:
1).¡¡String¶ÔÏóµÄÄÚÈÝÊDz»ÄܸıäµÄ,a+="World"²¢²»ÊǰÑaËùÖ¸¶ÔÏó¸Ä±ä,
¡¡¡¡¶øÊÇÏÈÉú³ÉÒ»¸öÁÙʱString¶ÔÏó,ÆäֵΪa+"World",È»ºóÔÚ°ÑÕâ¸öÁÙʱ
¡¡¡¡¶ÔÏ󸳸øa.
2).¡¡JavaÖк¯Êý²ÎÊý´«µÝ·½Ê½ÎªCall by value,link·½·¨ÖлáÉú²úaµÄÒ»¸ö
¡¡¡¡¿½±´,ͬÑùÖ¸ÏòaËùÖ¸µÄ¶ÔÏó,×ÛºÏÒÔÉÏÁ½µã,µÃ³ö½á¹ûΪ Hello
2. д³öÏÂÃæ´úÂëµÄ½á¹û
System.out.println(
"
ja
"
+
"
va
"
==
"
java
"
);
´ð:"=="ÓÃÀ´±È½Ï¶ÔÏóµÄÒýÓÃ,¶øequals()ÓÃÀ´±È½Ï¶ÔÏóµÄÄÚÈÝ,µ«ÊÇÈç¹ûÊÇ×Ö·û´®³£Á¿,ÓÃ"=="Ò²¿ÉÒԱȽÏÄÚÈÝ
ÊÇ·ñÏàµÈ,"ja"+"va"ºÍ"java"¶¼ÊÇ×Ö·û´®³£Á¿,Òò´Ë½á¹ûΪtrue
ͬÀí,ÏÂÃæ´úÂë½á¹ûÒ²ÊÇtrue
final
String str
=
"
java
"
;
System.out.println(str
==
"
java
"
)
3.¼Ì³ÐʱºòÀàµÄÖ´ÐÐ˳ÐòÎÊÌâ,Ò»°ã¶¼ÊÇÑ¡ÔñÌâ,ÎÊÄ㽫»á´òÓ¡³öʲô?
public
class
Parent {
//1
static
int
a = 1;
//2
static
{
a=10;
System.out.println("parent static
code"
);
}
//4
public
Parent(){
System.out.println("Parent constructor
Ïà¹ØÎĵµ£º
ÔÚjavaÏîÄ¿¼¯³Éflex¿ª·¢ÔÚweb2.0ÊÇÊÇÒ»¸öÊ®·ÖÓмÛÖµµÄ¿ª·¢·½°¸£¬ÌرðÔÚÆóÒµ¼¶µÄÓ¦ÓÃÖУ¬flexºÍjava¼äµÄͨѶԽÏÔÖØÒª¡£µ«ÊÇÏÖÔÚµÄjavaºÍflexµÄ¿ò¼ÜËäÈ»¶à£¬µ«Êǹ²Í¨ÐÔ²»´ó¡£¾ÍÊÇͨ¹ý´«Í³µÄwebserviceµ÷Óã¬Ò²ÒòΪЧÂÊÎÊÌâºÍ½âÎöxmlµÄ·±ÖصŤ×÷£¬ºÜ¶àÏîÄ¿¿ª·¢ËٶȺÍά»¤ÏÞÖÆ½Ï´ó¡£ÔÚ½üÀ´ÏîÄ¿£¬ÎÒÔÚ¹«Ë¾³¢Ê ......
¡¡¡¡¾Ý¹úÍâýÌ屨µÀ£¬MozillaÒѾÕë¶ÔFirefoxÉèÖÃÁËÒ»¸ö¶ñÒâJava²å¼þÆÁ±ÎºÚÃûµ¥¡£
¡¡¡¡¾Ý°²È«²©¿ÍBrian Krebs½éÉÜ£¬ÉÏÖܼ׹ÇÎĹ«Ë¾·¢²¼ÁËÒ»¸öÐÞ¸´Java²å¼þ©¶´µÄ¸üУ¬µ«ÊÇMozilla¿ª·¢ÈËÔ±·¢ÏÖ£¬Õâ¸ö¸üÐÂûÓÐɾ³ý¾É°æ±¾µÄ´úÂ룬ʹµÃϵͳÈÔÈ»ÁôÏÂÁË©¶´´úÂ룬´Ó¶øÊ¹µÃÒÅÁô´úÂë³ÉΪеĩ¶´¡£¶Ô´Ë£¬Mozilla²»µÃ²»½«ÆÁ± ......
ÓÃCµÄÈËÒ»¶¨ÖªµÀ__FILE__ºÍ__LINE__,µ«ÊÇJavaÖÐ ²¢Ã»ÓÐÕâÑùµÄ¶¨Ò壬ÓÐʱºòµ÷ÊÔ¶àÏ߳̾ͺܲ»·½±ã£¬Ã»°ì·¨£¬×Ô¼º¶¯ÊÖ£¬·áÒÂ×ãʳ~ÓÃÏÂÃæµÄº¯ÊýÈ¡µÃµ±Ç°Ðкš£
º¯Êý£º
/**
*µÃµ½ExceptionËùÔÚ´úÂëµÄÐÐÊý
*Èç¹ûûÓÐÐÐÐÅÏ¢,·µ»Ø-1
*/
public static int getLineNumber(Exception e){
StackTraceElement[] trace =e.getStac ......
Òì³£ÊÇÖ¸³ÌÐòÔËÐÐÆÚ¼ä³öÏÖµÄÎÊÌâ¡£ÔÚд³ÌÐòʱ£¬È·Êµ¿ÉÒÔд´úÂë²âÊÔ³ÌÐòÊÇ·ñÕýÈ·Ö´ÐУ¬Èç¹ûûÓÐÖ´ÐУ¬ÔòÖ´ÐдíÎó´¦Àí¡£¾¡¹ÜÕâÖÖÐÎʽµÄ´íÎó´¦ÀíÄܹ»Æðµ½×÷Ó㬵«³ÌÐòÂß¼Óë´íÎó´¦ÀíÒ»Æð»ìÓ㬻áʹµÃ³ÌÐòÄÑÒÔÔĶÁ‘Ð޸ġ£Èç¹ûDZÔÚµÄÎÊÌ⼫ÉÙ·¢Éú£¬Ôò»ìÓóÌÐòºÍ´íÎó´¦ÀíÂß¼½²½µµÍ³ÌÐòµÄÐÔÄÜ¡£Òì³£´¦Àíʹ³ÌÐòÔ±Äܹ»´Ó³ÌÐòÖ ......
Ò»¡¢ÏîÄ¿°æ±¾¹æ·¶£º
1¡¢°æ±¾ºÅÃüÃû¸ñʽ£º
V Ö÷°æ±¾ºÅ.´Î°æ±¾ºÅ.ÐÞÕû°æ±¾ºÅ
a£®³õʼ°æ±¾ºÅΪV1.0.0£»
b£®ÀàÊôÐÔ»òÀà·½·¨µÄÄÚÈÝ·¢Éú±ä»¯Ê±£¬Ö÷°æ±¾ºÅºÍ´Î°æ±¾ºÅ¶¼²»±ä£¬ÐÞÕû°æ±¾ºÅ¼Ó 1£»
c£®Ôö¼ÓÁËÀà»ò½Ó¿Ú·½·¨Ê±£¬Ö÷°æ±¾ºÅ²»±ä£¬´Î°æ±¾ºÅ¼Ó 1£¬ÐÞÕû°æ±¾ºÅ¸´Î»Îª0£»
d£®Ôö¼ÓÁËÀà»ò½Ó¿Úʱ£¬Ö÷°æ±¾ºÅ¼Ó1£¬´Î°æ±¾ºÅ¸´Î»Îª0 ......