Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

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


Ïà¹ØÎĵµ£º

JAVA ´úÀíģʽ

¶¯Ì¬´úÀí£º
public interface Qingke {
void qk();
}
public class dsz implements Qingke{
 
 public void qk() {
  System.out.print("dsz qk");
 }
}
public class Secretary implements InvocationHandler {
 private Object pro;
 private dsz dsz;
 public Obj ......

ÔÚJava³ÌÐòÖнػñ¿ØÖÆÌ¨Êä³ö

     ±¾ÎĵÄÄ¿±êÊÇÉè¼ÆÒ»¸ö»ùÓÚSwingµÄJTextAreaÏÔʾ¿ØÖÆÌ¨Êä³ö¡£´ËÆÚ¼ä£¬ÎÒÃÇ»¹½«ÌÖÂÛһЩºÍJava¹ÜµÀÁ÷£¨PipedInputStreamºÍPipedOutputStream£©ÓйصÄ×¢ÒâÊÂÏî¡£×îºó»¹Òª´´½¨Ò»¸öÄܹ»²¶»ñºÍÏÔʾÆäËû³ÌÐò£¨¿ÉÒÔÊÇ·ÇJavaµÄ³ÌÐò£©¿ØÖÆÌ¨Êä³öµÄ¼òµ¥³ÌÐò¡£
Ò»¡¢Java¹ÜµÀÁ÷
     ÒªÔÚÎı¾ ......

JAVA JDBC ¼òµ¥·ÖÒ³

        /**
          *ÐèÒª´«Èë pageNo µ±Ç°Ò³
          *             pageSizeÒ»Ò³ÏÔʾµÄÌõÊý
      ......

¿ì²¥javaÃæÊÔÌâ

1.±ÊÊÔÌâºÜ¼òµ¥£¬¶¼ÊÇһЩ»ù´¡ÖªÊ¶¡£
2.ÓиöÃæÊÔÌâ±»Äѵ¹ÁË£¬¿´ÊÇ·ñÓÐÄÄλ´óÏÀÄܵ㲦µã²¦
  
   ¹ØÓÚ´óÈÝÁ¿Îı¾¼ìË÷µÄÎÊÌ⣺һ¸öÎı¾ÎļþÖÐÓм¸Ê®ÍòÌõ»ò¸ü¶àµÄ¼Ç¼£¬¼Ç¼ÒÔÐÐΪµ¥Î»£¬Ã¿ÐеÄÐÅÏ¢ÈçÏ£º
   Óû§id£¬Óû§Ãû£¬..........................
  
  ÓÐʲôºÃµ ......

һЩ³£¼ûJavaÒì³£¹éÀà(¶þ)

ËãÊõÒì³£ÀࣺArithmeticExecption
¡¡¡¡¿ÕÖ¸ÕëÒì³£ÀࣺNullPointerException
¡¡¡¡ÀàÐÍÇ¿ÖÆ×ª»»Òì³££ºClassCastException
¡¡¡¡Êý×鸺ϱêÒì³££ºNegativeArrayException
¡¡¡¡Êý×éϱêÔ½½çÒì³££ºArrayIndexOutOfBoundsException
¡¡¡¡Î¥±³°²È«Ô­ÔòÒì³££ºSecturityException
¡¡¡¡ÎļþÒѽáÊøÒì³££ºEOFException
¡¡¡¡ÎļþÎ´Õ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ