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 EEÁË¡£Ò»°ãÀ´Ëµ£¬Ò»¸ö³ÉÊìµÄjava EE½â¾ö·½°¸£¬°üÀ¨ÒÔϼ¸¸ö²¿·Ö¡£
1¡¢¿ÉÒÔ¶ÔÍâÌṩ»ùÓÚ±ê×¼ÐÒéÈçxmlµÄ·þÎñ
ÈçWeb Service
2¡¢ÄÚ²¿Í¨ÐÅ»ùÓÚÃæÏò¶ÔÏóµÄͨÐÅÐÒé
Èç RMI£¬Corba£¬XML RPC
3¡¢°²È«ÐԸߣ¬È¨ÏÞ¿ØÖÆÑϸñ
Èç MD5£¬SSL£¬AccountDomain
4 &nbs ......
²âÊÔÖз¢ÏÖÈç¹û¼¸¸ö´¦ÓÚ¿ÉÔËÐÐ״̬µÄÏ̵߳ÄÓÅÏȼ¶¶¼Ð¡ÓÚ»òÕßµÈÓÚ6ʱ£¬yield()·½·¨¿É½«ÔËÐлú»áÈøøÓÅÏȼ¶Îª6ºÍÓÅÏȼ¶Îª5µÄÏ̡߳£
¶øÈç¹ûµ÷ÓÃÁËyield()·½·¨µÄÏ̵߳ÄÓÅÏȼ¶´óÓÚ»òµÈÓÚ7ʱ£¬Ôò²»»á½«ÔËÐлú»áÈøøÆäËûÏ̡߳£ ......
´ÓÎïÀíÉϽ²£¬¶ÑÕ»¾ÍÊÇÒ»¶ÎÁ¬Ðø·ÖÅäµÄÄÚ´æ¿Õ¼ä¡£ÔÚÒ»¸ö³ÌÐòÖУ¬»áÉùÃ÷¸÷ÖÖ±äÁ¿¡£¾²Ì¬È«¾Ö±äÁ¿ÊÇλÓÚÊý¾Ý¶Î²¢ÇÒÔÚ³ÌÐò¿ªÊ¼µÄʱºò¾Í±»¼ÓÔØ¡£¶ø³ÌÐòµÄ¶¯Ì¬µÄ¾Ö²¿±äÁ¿Ôò·ÖÅäÔÚ¶ÑÕ»ÀïÃæ¡£
JVM¹ÜÀíÁ½ÖÖÀàÐ͵ÄÄڴ棬¶ÑºÍ·Ç¶Ñ¡£¶ÑÊǸø¿ª·¢ÈËÔ±ÓõÄÉÏÃæËµµÄ¾ÍÊÇ£¬ÊÇÔÚJVMÆô¶¯Ê±´´½¨£»·Ç¶ÑÊÇÁô¸øJVM×Ô¼ºÓõģ¬ÓÃÀ´´æ·ÅÀàµÄÐÅÏ¢µÄ¡£Ëüº ......
JDK 6.0 ÒÔ¼°JDK 5.0 update 9 µÄ nioÖ§³Öepoll £¨½öÏÞ Linux
ϵͳ
£©£¬¶Ô²¢·¢idle connection»áÓдó·ù¶ÈµÄÐÔÄÜÌáÉý£¬Õâ¾ÍÊǺܶàÍøÂç·þÎñÆ÷Ó¦ÓóÌÐòÐèÒªµÄ¡£
ÆôÓõķ½·¨ÈçÏ£º
-Djava.nio.channels.spi.SelectorProvider=sun.nio.ch.EPollSelectorProvider
ÀýÈçÔÚ Linux ÏÂÔËÐÐµÄ Tomcat ʹÓà NIO Connector £¬ÄÇôÆô ......
ÓÃCµÄÈËÒ»¶¨ÖªµÀ__FILE__ºÍ__LINE__,µ«ÊÇJavaÖÐ ²¢Ã»ÓÐÕâÑùµÄ¶¨Ò壬ÓÐʱºòµ÷ÊÔ¶àÏ߳̾ͺܲ»·½±ã£¬Ã»°ì·¨£¬×Ô¼º¶¯ÊÖ£¬·áÒÂ×ãʳ~ÓÃÏÂÃæµÄº¯ÊýÈ¡µÃµ±Ç°Ðкš£
º¯Êý£º
/**
*µÃµ½ExceptionËùÔÚ´úÂëµÄÐÐÊý
*Èç¹ûûÓÐÐÐÐÅÏ¢,·µ»Ø-1
*/
public static int getLineNumber(Exception e){
StackTraceElement[] trace =e.getStac ......