JAVAÒì³£×Ü½á ¼Ì³Ð
ÒÔÏÂÊǶÔJAVAÒì³£µÄ¼Ì³Ð»úÖÆµÄһЩ×ܽᡣ
1. RuntimeExceptionÓëException, Error²»Í¬µã£º µ±·½·¨ÌåÖÐÅ׳ö·ÇRuntimeException£¨¼°Æä×ÓÀࣩʱ£¬·½·¨Ãû±ØÐëÉùÃ÷Å׳öµÄÒì³££»µ«Êǵ±·½·¨ÌåÖÐÅ׳öRuntimeException£¨°üÀ¨RuntimeException×ÓÀࣩʱ£¬·½·¨Ãû²»±ØÉùÃ÷¸Ã¿ÉÄܱ»Å׳öµÄÒì³££¬¼´Ê¹ÉùÃ÷ÁË£¬JAVA³ÌÐòÔÚij¸öµ÷Óõĵط½£¬Ò²²»ÐèÒªtry-catch´Ó¾äÀ´´¦ÀíÒì³£¡£
class TestA{
//compiles fine.we don't need to claim the RuntimeException to be thrown here
void method(){
throw new RuntimeException();
}
}
class TestB{
void method() throws RuntimeException{
throw new RuntimeException();
}
void invokeMethod(){
//compiles fine. we don't need the try-catch clause here
method();
}
}
class TestC{
//compiles error.we need to claim the Exception to be thrown on the method name
void method(){
throw new Exception();
}
}
class TestD{
//compiles fine.
void method() throws Exception{
throw new Exception();
}
}
ÒÔÏÂËùÓеÄÏà¹ØÒì³£µÄÌØÐÔ¶¼²»°üÀ¨RuntimeException¼°Æä×ÓÀà¡£
2. ¼ÙÈçÒ»¸ö·½·¨ÔÚ¸¸ÀàÖÐûÓÐÉùÃ÷Å׳öÒì³££¬ÄÇô£¬×ÓÀา¸Ç¸Ã·½·¨µÄʱºò£¬²»ÄÜÉùÃ÷Òì³£¡£
class TestA{
void method(){}
}
class TestB extends TestA{
//complies error if the method overrided pertaining to the base class doesn't declare throwing exceptions
void method() throws Exception{
throw new Exception();
}
}
3. ¼ÙÈçÒ»¸ö·½·¨ÔÚ¸¸ÀàÖÐÉùÃ÷ÁËÅ׳öÒì³££¬×ÓÀา¸Ç¸Ã·½·¨µÄʱºò£¬ÒªÃ´²»ÉùÃ÷Å׳öÒì³££¬ÒªÃ´ÉùÃ÷±»Å׳öµÄÒì³£¼Ì³Ð×ÔËüËù¸²¸ÇµÄ¸¸ÀàÖеķ½·¨Å׳öµÄÒì³£¡£
class TestA{
void method() throws RuntimeException{}
}
class TestB extends TestA{
//compiles fine if current method does not throw any exceptions
void method(){}
}
class TestC extends TestA{
//compiles fine because NullPointerException is inherited from RuntimeException which is thrown by the overrided method of the base class
void method() throws NullPointerException{}
}
class TestD extends TestA{
//compiles error because Exception thrown by current method is not inherited from RuntimeException which is thr
Ïà¹ØÎĵµ£º
±¾ÎĵÄÔ¤¶¨¶ÁÕßÊ×ÏÈÒª¶Ôj2eeÓÐËùÁ˽⣬ÊìϤxml£¬tomcatµÈ»ù±¾ÄÚÈÝ£¬±¾ÎÄÖ÷ÒªÊǼòµ¥½éÉÜÒ»ÏÂweb·þÎñµÄ»ù±¾ÄÚÈÝ£¬ÔõÑùÔÚjava web¿ª·¢Öй¹½¨SOAP·þÎñ£º
Ò»¡¢
SOAP£¨Simple Object Access
Protocol£©¼òµ¥¶ÔÏó·ÃÎÊÐÒ飬ҪÁ˽âSOAP£¬Ê×ÏȾÍÐèÒªÁ˽â·Ö²¼Ê½¼ÆËãµÄÓÉÀ´£¬Ëæ×ÅÏÂÒ»´úµÄ·Ö²¼Ê½¼ÆËãÌåϵweb·þÎñµÄ³öÏÖ£¬SOAP³É ......
Á½ÖÖ½¨Á¢Ï̶߳ÔÏóµÄ·½·¨£º
Extends Thread
implement Runnable
ÕâÁ½ÖÖ·½·¨¶¼¿ÉÒÔ´´½¨Ò»¸öÏ̶߳ÔÏó£¬
public class TestThread {
public static void main(String arg[]){
newThread thread = new ne ......
1.±ÊÊÔÌâºÜ¼òµ¥£¬¶¼ÊÇһЩ»ù´¡ÖªÊ¶¡£
2.ÓиöÃæÊÔÌâ±»Äѵ¹ÁË£¬¿´ÊÇ·ñÓÐÄÄλ´óÏÀÄܵ㲦µã²¦
¹ØÓÚ´óÈÝÁ¿Îı¾¼ìË÷µÄÎÊÌ⣺һ¸öÎı¾ÎļþÖÐÓм¸Ê®ÍòÌõ»ò¸ü¶àµÄ¼Ç¼£¬¼Ç¼ÒÔÐÐΪµ¥Î»£¬Ã¿ÐеÄÐÅÏ¢ÈçÏ£º
Óû§id£¬Óû§Ãû£¬..........................
ÓÐʲôºÃµ ......
ÏàÐÅ´ó¼Ò¶¼ÓÃjavadocµÄÃüÁîÉú³É¹ýapi help °É£¿µ«Êǰü×¢ÊÍÔõôÀ´µÄÄØ£¿½ñÌìѧϰԴ´úÂëµÄʱºò·¢ÏÖÁËÕâ¸ö°ü×¢Ê͵ÄÀ´Ô´¡£
±ÈÈ磺org.apache.james.utilÕâ¸öµÄ°ü×¢ÊÍ¡£ÔÚÕâ¸ö°üϱßÓÐÒ»¸öpackage.htmlµÄÎļþ¡£
<body>
<p>A variety of utility classes used inside James.</p>
</body>
ÕâÑùÔÙÓ ......
package info.gnuhpc;
/**
* @author gnuhpc email: warmbupt@gmail.com blog: http://gnuhpc.info
* @date 2010-1-22
* @bugs ²»Ö§³Ö¶àÒô×Ö´¦Àí
*/
public class PinyinConv {
// ¼òÌåÖÐÎĵıàÂ뷶Χ´ÓB0A1£¨45217£©Ò»Ö±µ½F7FE£¨63486£©
private static int BEGIN = 45217;
private static int ......