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

±ÜÃâÔÚJavaÖÐʹÓÃChecked Exception

JavaµÄException·ÖΪÁ½À࣬һÀàÊÇRuntimeException¼°Æä×ÓÀ࣬ÁíÍâÒ»Àà¾ÍÊÇchecked
Exception¡£JavaÒªÇóº¯Êý¶ÔûÓб»catch´¦ÀíµôµÄchecked
Exception£¬ÐèÒª½«ÆäдÔÚº¯ÊýµÄÉùÃ÷²¿·Ö¡£È»¶ø£¬ÕâÒ»ÒªÇó³£³£¸ø³ÌÐòÔ±´øÀ´Ò»Ð©²»±ØÒªµÄ¸ºµ£¡£
ΪÁ˱ÜÃâÔÚº¯ÊýÉùÃ÷ÖÐдthrows²¿·Ö£¬ÔÚJavaÏîÄ¿ÀïÃæ³£³£¿ÉÒÔ¿´µ½ÒÔÏ´úÂëÓÃÀ´‘Í̵ô’Exception£º
try {
// ...
} catch (Exception ex) {
ex.printStackTrace();
}
ÕâÏÔÈ»²»ÊÇÒ»¸öºÃµÄ´¦ÀíException°ì·¨£¬ÊÂʵÉÏ£¬catch²¢´¦ÀíÒ»¸öExceptionÒâζ×ÅÈóÌÐò´Ó·¢ÉúµÄ´íÎó(Exception)Öлָ´¹ýÀ´¡£´ÓÕâÖÖÒâÒåÉÏ˵£¬ÒÑÉϵĴúÂëÖ»¿ÉÄÜÔÚһЩºÜ¼òµ¥µÄÇé¿öϹ¤×÷¶ø²»´øÀ´ÎÊÌâ¡£
¶Ô
ÓںܶàException£¬ÍùÍùûÓÐÈ¥´¦ÀíËü²¢ÈóÌÐò´Ó´íÎóÖлָ´³öÀ´µÄ°ì·¨£¬ÕâʱΨһÄÜ×öµÄÊÂÇé¿ÉÄܾÍÊÇÔÚ½çÃæÉÏÏÔʾһЩÌáʾÐÅÏ¢¸øÓû§¡£ÕâÖÖÇé¿öÏÂÈÃ
³ÌÐòÅ׳öÓöµ½µÄExceptionÊǸüΪºÏÀíµÄ×ö·¨¡£È»¶ø£¬ÕâÑù×ö»áʹµÃһЩº¯ÊýµÄÉùÃ÷¼±¾çÅòÕÍ¡£Ò»¸öº¯Êý¿ÉÄÜÐèÒªÉùÃ÷»áÅ׳öµÄ7¡¢8¸öchecked
Exception£¬¶øÇÒÿ¸öµ÷ÓÃËüµÄº¯ÊýÒ²ÐèҪͬÑùµÄÉùÃ÷¡£
±ÈÕâ¸üÔã¸âµÄÊÇ£¬ÕâÓпÉÄÜÆÆ»µÀàÉè¼ÆµÄopen-closeÔ­Ôò¡£¼òµ¥À´
˵£¬open-closeÔ­ÔòÊÇÖ¸µ±À©Õ¹Ò»¸öÄ£¿éµÄʱºò£¬¿ÉÒÔ²»Ó°ÏìÆäÏÖÓеÄclient¡£open-closeÔ­ÔòÊÇͨ¹ý¼Ì³ÐÀ´ÊµÏֵ쬵±¼Ì³ÐÒ»¸öÀàµÄ
ʱºò£¬ÎÒÃǼÈÀ©Õ¹ÁËÕâ¸öÀ࣬Ҳ²»»áÓ°ÏìÔ­ÓеÄclient£¨ÒòΪ¶ÔÕâ¸öÀàûÓи͝£©¡£
¡¡¡¡ÏÖÔÚ¿¼ÂÇÏÂÃæÕâÖÖÇé¿ö£¬ÓÐÒ»¸ö¸¸ÀàBase£º
public class Base {
public void foo() throws ExceptionA {
// ...
}
}
¡¡¡¡ÏÖÔÚÐèÒª¼Ì³ÐBaseÕâ¸öÀà²¢ÖØÔØfooÕâ¸ö·½·¨£¬ÔÚеÄʵÏÖÖУ¬foo¿ÉÄÜÅ׳öExceptionB£º
public class Extend extends Base {
public void foo() throws ExceptionB {
// ...
}
}
¡¡¡¡È»¶ø£¬ÕâÑùдÔÚJavaÀïÃæÊDz»ºÏ·¨µÄ£¬ÒòΪJava°Ñ¿ÉÄÜ»áÅ׳öµÄException¿´×÷º¯ÊýÌØÕ÷µÄÒ»²¿·Ö£¬×ÓÀàÉùÃ÷Å׳öµÄException±ØÐëÊǸ¸ÀàµÄ×Ó¼¯¡£
¡¡¡¡¿ÉÒÔÔÚBaseÀàµÄfoo·½·¨ÖмÓÈëÅ׳öExceptionBµÄÉùÃ÷£¬È»¶ø£¬ÕâÑù¾ÍÆÆ»µÁËopen-closeÔ­Ôò¡£¶øÇÒ£¬ÓÐʱÎÒÃÇûÓа취ȥÐ޸ĸ¸À࣬±ÈÈçµ±ÖØÔØÒ»¸öJdkÀïµÄÀàµÄʱºò¡£
¡¡¡¡ÁíÒ»¸ö¿ÉÄܵÄ×ö·¨ÊÇÔÚExtendµÄfoo·½·¨ÖÐcatchסExceptionB£¬È»ºó¹¹ÔìÒ»¸öExceptionA²¢Å׳ö¡£ÕâÊǸö¿ÉÐеİ취µ«Ò²Ö»ÊÇÒ»¸öȨÒËÖ®¼Æ¡£
¡¡
¡¡Èç¹ûʹÓÃRuntimeException£¬ÕâЩÎÊÌâ¶¼²»»á´æÔÚ¡£Õâ˵Ã÷checked
Exception²¢²»ÊÇÒ»¸öºÜʵÓõĸÅÄҲÒâζ×ÅÔÚ³ÌÐòÉè¼ÆµÄʱºò£¬ÎÒÃÇÓ¦¸ÃÈÃ×Ô


Ïà¹ØÎĵµ£º

´¿Java¶ÁÈ¡¡¢ÏÔʾ¡¢×ª»»wordÎĵµ(97~2007)¡¢htmlÎĵµ

´¿Java¶ÁÈ¡¡¢ÏÔʾ¡¢×ª»»wordÎĵµ(97~2007)¡¢htmlÎĵµ
ÏÂÔØ³ÌÐò¿â
http://hgsqldoc.appspot.com/lib/hg.jar
Ö÷³ÌÐò¿â£¨±ØÐ룩
http://hgsqldoc.appspot.com/lib/poi.jar
½âÎödoc¸ñʽ
http://hgsqldoc.appspot.com/lib/itext.jar
Êä³öpdfºÍrtf
http://hgsqldoc.appspot.com/lib/fgio.jar
Êä³ösvg¡¢swf¡¢ps¡¢emf
¶ÁÈ ......

½«java³ÌÐò°²×°³Éwindows·þÎñ

×î½ü¹¤×÷ÐèÒª½«java³ÌÐò´ò°ü·¢²¼£¬²¢ÇÒÄܰ²×°³Éwindows·þÎñ£¬¶øÇÒÐèÒªÔÚûÓа²×°jreµÄ»úÆ÷ÉÏÔËÐС£Ñо¿ÁËÒ»ÏÂjava service wrapper£¬ÔÚÍøÉÏÕÒÁËÏà¹ØµÄ×ÊÁÏ£¬µ«ÊǶ¼ËµµÃ²»ÊǺÜÏêϸ£¬ÕÕ×Å×öÓÐÒ»¶¨ÄѶȡ£ËùÒÔÎÒ·Ö²½×ܽáÁËһϣ¬Ï£Íû¸øÓöµ½ÏàͬÎÊÌâµÄͬÈÊÒ»µã°ïÖú¡£
1.       Ê×ÏÈÏÂÔØjava serv ......

Java Mail ·¢ËÍÓʼþ

package com.eastpro.batch.biz;
import java.util.*;
import javax.mail.*;
import javax.mail.internet.*;
import javax.activation.*;
import java.security.spec.X509EncodedKeySpec;
public class SendMail {
  private MimeMessage mimeMsg; //MIME mail object
  private Session session;
  ......

Java Mail send email

package com.eastpro.batch.biz;
//import javax.activation.*;
import javax.activation.DataHandler;
import javax.activation.FileDataSource;
import javax.mail.internet.*;
import javax.mail.*;
import java.io.UnsupportedEncodingException;
import java.util.*;
/**
 * Insert the type's descript ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ