javaÒì³£
Throwable
Throwable ÀàÊÇ Java ÓïÑÔÖÐËùÓдíÎó»òÒì³£µÄ³¬Àà¡£Ö»Ó屶ÔÏóÊÇ´ËÀࣨ»òÆä×ÓÀàÖ®Ò»£©µÄʵÀýʱ£¬²ÅÄÜͨ¹ý Java ÐéÄâ»ú»òÕß Java throw Óï¾äÅ׳ö¡£ÀàËƵأ¬Ö»ÓдËÀà»òÆä×ÓÀàÖ®Ò»²Å¿ÉÒÔÊÇ catch ×Ó¾äÖеIJÎÊýÀàÐÍ¡£
Á½¸ö×ÓÀàµÄʵÀý£¬Error ºÍ Exception£¬Í¨³£ÓÃÓÚָʾ·¢ÉúÁËÒì³£Çé¿ö¡£Í¨³££¬ÕâЩʵÀýÊÇÔÚÒì³£Çé¿öµÄÉÏÏÂÎÄÖÐнü´´½¨µÄ£¬Òò´Ë°üº¬ÁËÏà¹ØµÄÐÅÏ¢£¨±ÈÈç¶ÑÕ»¸ú×ÙÊý¾Ý£©¡£
2¡¢Exception
Exception À༰Æä×ÓÀàÊÇ Throwable µÄÒ»ÖÖÐÎʽ£¬ËüÖ¸³öÁ˺ÏÀíµÄÓ¦ÓóÌÐòÏëÒª²¶»ñµÄÌõ¼þ£¬±íʾ³ÌÐò±¾Éí¿ÉÒÔ´¦ÀíµÄÒì³£¡£
3¡¢Error
Error ÊÇ Throwable µÄ×ÓÀ࣬±íʾ½ö¿¿³ÌÐò±¾ÉíÎÞ·¨»Ö¸´µÄÑÏÖØ´íÎó£¬ÓÃÓÚָʾºÏÀíµÄÓ¦ÓóÌÐò²»Ó¦¸ÃÊÔͼ²¶»ñµÄÑÏÖØÎÊÌâ¡£
ÔÚÖ´Ðи÷½·¨Æڼ䣬ÎÞÐèÔÚ·½·¨ÖÐͨ¹ýthrowsÉùÃ÷¿ÉÄÜÅ׳öµ«Ã»ÓⶻñµÄ Error µÄÈκÎ×ÓÀ࣬ÒòΪJava±àÒëÆ÷²»È¥¼ì²éËü£¬Ò²¾ÍÊÇ˵£¬µ±³ÌÐòÖпÉÄܳöÏÖÕâÀàÒ쳣ʱ£¬¼´Ê¹Ã»ÓÐÓÃtry...catchÓï¾ä²¶»ñËü£¬Ò²Ã»ÓÐÓÃthrows×Ö¾äÉùÃ÷Å׳öËü£¬»¹ÊÇ»á±àÒëͨ¹ý¡£
4¡¢RuntimeException
RuntimeException ÊÇÄÇЩ¿ÉÄÜÔÚ Java ÐéÄâ»úÕý³£ÔËÐÐÆÚ¼äÅ׳öµÄÒì³£µÄ³¬Àà¡£Java±àÒëÆ÷²»È¥¼ì²éËü£¬Ò²¾ÍÊÇ˵£¬µ±³ÌÐòÖпÉÄܳöÏÖÕâÀàÒ쳣ʱ£¬¼´Ê¹Ã»ÓÐÓÃtry...catchÓï¾ä²¶»ñËü£¬Ò²Ã»ÓÐÓÃthrows×Ö¾äÉùÃ÷Å׳öËü£¬»¹ÊÇ»á±àÒëͨ¹ý£¬ÕâÖÖÒì³£¿ÉÒÔͨ¹ý¸Ä½ø´úÂëʵÏÖÀ´±ÜÃâ¡£
5¡¢ThreadDeath
µ÷Óà Thread ÀàÖдøÓÐÁã²ÎÊýµÄ stop ·½·¨Ê±£¬Êܺ¦Ï߳̽«Å׳öÒ»¸ö ThreadDeath ʵÀý¡£
½öµ±Ó¦ÓóÌÐòÔÚ±»Òì²½ÖÕÖ¹ºó±ØÐëÇå³ýʱ²ÅÓ¦¸Ã²¶»ñÕâ¸öÀàµÄʵÀý¡£Èç¹û ThreadDeath ±»Ò»¸ö·½·¨²¶»ñ£¬ÄÇô½«ËüÖØÐÂÅ׳ö·Ç³£ÖØÒª£¬ÒòΪÕâÑù²ÅÄÜÈøÃÏß³ÌÕæÕýÖÕÖ¹¡£
Èç¹ûûÓⶻñ ThreadDeath£¬Ôò¶¥¼¶´íÎó´¦Àí³ÌÐò²»»áÊä³öÏûÏ¢¡£
ËäÈ» ThreadDeath ÀàÊÇ“Õý³£³öÏÖ”µÄ£¬µ«ËüÖ»ÄÜÊÇ Error µÄ×ÓÀà¶ø²»ÊÇ Exception µÄ×ÓÀ࣬ÒòΪÐí¶àÓ¦ÓóÌÐò²¶»ñËùÓгöÏÖµÄ Exception£¬È»ºóÓÖ½«Æä·ÅÆú¡£
ÒÔÉÏÊǶÔÓйØÒì³£APIµÄÒ»¸ö¼òµ¥½éÉÜ£¬Ó÷¨¶¼ºÜ¼òµ¥£¬¹Ø¼üÔÚÓÚÀí½âÒì³£´¦ÀíµÄÔÀí£¬¾ßÌåÓ÷¨²Î¿´Java APIÎĵµ¡£
Èý¡¢JavaÒì³£´¦Àí»úÖÆ
¶ÔÓÚ¿ÉÄܳöÏÖÒì³£µÄ´úÂ룬ÓÐÁ½ÖÖ´¦Àí°ì·¨£º
µÚÒ»¡¢ÔÚ·½·¨ÖÐÓÃtry...catchÓï¾ä²¶»ñ²¢´¦ÀíÒì³££¬catachÓï¾ä¿ÉÒÔÓжà¸ö£¬ÓÃÀ´Æ¥Åä¶à¸öÒì³£¡£ÀýÈ磺
public void p(int x){
try{
...
}catch(Exception e){
...
}finally{
...
}
}
µÚ¶þ¡¢¶ÔÓÚ´¦Àí²»Á˵ÄÒì³£»òÕßҪתÐ͵ÄÒì³££¬ÔÚ·½·¨µ
Ïà¹ØÎĵµ£º
java ͨ¹ýSystem.getProperties()»ñȡϵͳ²ÎÊý
Properties props=System.getProperties(); //ϵͳÊôÐÔ
System.out.println("JavaµÄÔËÐл·¾³°æ±¾£º"+props.getProperty("java.version"));
System.out.println("JavaµÄÔËÐл·¾³¹©Ó¦ÉÌ£º"+props.getProperty("java.vendor"));
......
×÷ΪJava³ÌÐòÔ±À´Ëµ£¬×îÍ´¿àµÄÊÂÇéĪ¹ýÓÚ¿ÉÒÔÑ¡ÔñµÄ·¶Î§Ì«¹ã£¬¿ÉÒÔ¶ÁµÄÊéÌ«¶à£¬ÍùÍùÈÝÒ×ÎÞËùÊÊ´Ó¡£ÎÒÏë¾ÍÎÒ×Ô¼º¶Á¹ýµÄ¼¼ÊõÊé¼®ÖÐÌôÑ¡³öÀ´Ò»Ð©£¬°´ÕÕѧϰµÄÏȺó˳Ðò£¬ÍƼö¸ø´ó¼Ò£¬ÌرðÊÇÄÇЩÏë²»¶ÏÌá¸ß×Ô¼º¼¼ÊõˮƽµÄJava³ÌÐòÔ±ÃÇ¡£
Ò»¡¢Java±à³ÌÈëÃÅÀà
¶ÔÓÚûÓÐJava±à³Ì¾ÑéµÄ³ÌÐòÔ±ÒªÈëÃÅ£¬Ëæ±ã¶ÁʲôÈëÃÅÊé¼®¶¼Ò»Ñù£¬Õâ ......
Java codeFormat ft=Format.getRawFormat();
ft.setEncoding("utf-8");
ft.setIndent(" ");//ÉèÖÃËõ½ø
XMLOutputter outputter=new XMLOutputter(ft);//ÉèÖÃXML¸ñʽ
Õâλ˵µÄ²»´í£»
ÔÚieÀïÃ棬ËüÄÜ°Ñxml×Ô¶¯½âÎö³ÆÊ÷Ðνṹ£¬ËùÒÔ¿´ÆðÀ´Ã»ÎÊÌ⣬ÔÚ¼Çʱ¾ÀïÃ棬¾Í²»ÐÐÁ ......
ͨ¹ý Groovy ½øÐÐÑ»·
ͬ´ó¶àÊý½Å±¾ÓïÑÔÒ»Ñù£¬Groovy ¾³£±»Ðû´«ÎªÉú²úÁ¦¸ü¸ß µÄ Java ÓïÑÔÌæ´úÆ·¡£ÄúÒѾ¿´µ½ÁË Groovy ȱÉÙÀàÐÍÄܹ»ÈçºÎ¼õÉÙ´ò×Ö¹¤×÷¡£ÔÚÕâÒ»½Ú£¬½«´´½¨²¢ÊÔÓÃÒ»¸ö repeat º¯Êý¡£ÔÚÕâ¸ö¹ý³ÌÖУ¬½«½øÒ»²½Ì½Ë÷ Groovy Ìá¸ßЧÂʵķ½Ê½¡£
¸üºÃ¡¢¸ü¶ÌµÄÑ»·
ÏÂÃæÕâÖÖ·½·¨¿ÉÒÔ¸üºÃµØ¸ÐÊÜ Groovy ȱ·¦ÀàÐ͵ĺà ......