JAVA finally×Ö¾äµÄÒì³£¶ªÊ§ºÍ·µ»ØÖµ¸²¸Ç½âÎö
JAVA finally×Ö¾äµÄÒì³£¶ªÊ§ºÍ·µ»ØÖµ¸²¸Ç½âÎö
JavaÐéÄâ»úÔÚÿ¸ötryÓï¾ä¿éºÍÓëÆäÏà¹ØµÄcatch×Ó¾äµÄ½áβ
´¦¶¼»á“µ÷ÓÔfinally×Ó¾äµÄ×ÓÀý³Ì¡£Êµ¼ÊÉÏ£¬finally×Ó¾äÔÚ·½·¨ÄÚ²¿µÄ±íÏÖºÜÏó“΢ÐÍ×ÓÀý³Ì”¡£finally×Ó¾äÕý³£½áÊøºó£Ö¸µÄÊÇfinally×Ó¾äÖÐ×îºóÒ»ÌõÓï¾äÕý³£Ö´ÐÐÍê±Ï£¬²»°üÀ¨Å׳öÒì³££¬»òÖ´ÐÐreturn¡¢continue¡¢breakµÈÇé¿ö£¬Á¥ÊôÓÚÕâ¸öfinally×Ó¾äµÄ΢ÐÍ×ÓÀý³ÌÖ´ÐГ·µ»Ø”²Ù×÷¡£³ÌÐòÔÚµÚÒ»´Îµ÷ÓÃ΢ÐÍ×ÓÀý³ÌµÄµØ·½¼ÌÐøÖ´ÐкóÃæµÄÓï¾ä¡£
finally“΢ÐÍ×ÓÀý³Ì”²»µÈͬÓÚ·½·¨º¯ÊýµÄµ÷Óã¬finally×Ӿ䶼ÊÇÔÚͬһ¸öÕ»ÄÚÖ´Ðеģ¬Î¢ÐÍ×ÓÀý³ÌµÄ“·µ»Ø”²Ù×÷Ò²²»»áÉæ¼°µ½·½·¨ÍËÕ»£¬½ö½öÊÇʹ³ÌÐò¼ÆÊýÆ÷pcÌøתµ½Í¬Ò»¸ö·½·¨µÄÒ»¸ö²»Í¬µÄλÖüÌÐøÖ´ÐС£
Ò»¡¡Òì³£¶ªÊ§
¡¡public static void exceptionLost()
{
try
{
try
{
throw new Exception( "exception in try" );
}
finally
{
throw new Exception( "exception in finally" );
}
}
catch( Exception e )
{
System.out.println( e );
}
}
exceptionLost()µÄÊä³ö½á¹ûÊÇ“exception in finally”£¬¶ø²»ÊÇtry¿éÖÐÅ׳öµÄÒì³££¬ÕâÊÇJAVAÒì³£»úÖƵÄÒ»¸ö覴ãÒì³£¶ªÊ§¡£
ÔÚ×Ö½ÚÂëÖУ¬throwÓï¾ä²»ÊÇÔ×ÓÐÔ²Ù×÷¡£ÔÚ½ÏÀϵÄJDKÖУ¬exceptionLost()ÖÐtry¿éµÄthrowÓï¾ä·Ö½âΪ¼¸²½²Ù×÷£º
1) °ÑException("exception in try")¶ÔÏóÒýÓô洢µ½Ò»¸ö¾Ö²¿±äÁ¿ÖÐ
¡¡¡¡astore_2 ¡¡// pop the reference to the thrown exception, store into local variable 2
£²) µ÷ÓÃfinally΢ÐÍ×Ó³ÌÐò
£³) °Ñ¾Ö²¿±äÁ¿ÖеÄException("exception in try")¶ÔÏóÒýÓÃpushµ½²Ù×÷ÊýÕ»¶¥£¬È»ºóÅ׳öÒì³£
¡¡¡¡aload_2 ¡¡// push the reference to the thrown exception from local variable 2
¡¡¡¡athrow ¡¡¡¡// throw the exception
Èç¹ûfinallyͨ¹ýbreak¡¢return¡¢continue£¬»òÕßÅ׳öÒì³£¶øÍ˳ö£¬ÄÇôÉÏÃæµÄµÚ£³²½¾Í²»»áÖ´ÐС£
ÔÚJDK1.6ÖУ¬Í¨¹ý×Ö½ÚÂëÎÒÃÇ¿ÉÒÔ¿´µ½£¬finally×Ó¾ä×÷ΪһÖÖÌØÊâµÄcatchÀ´ÊµÏֵģ¬ÏÂÃæÊÇexceptionLost()·½·¨µÄÒì³£±í£º
Exception table£º
from to ¡¡target ¡¡type
0 ¡¡10 10 ¡¡¡¡any
Ïà¹ØÎĵµ£º
JavaÅäÖÃÎļþ¶ÁÈ¡Óи÷ÖÖ²»Í¬µÄÎļþ£¬µ«ÊÇÓÉÓÚ´ò°üJarºóµÄ·¾¶¸Ä±ä£¬ÍùÍùÔÚÏîÄ¿ÖÐÄÜÕýÈ·¶ÁÈ¡µÄÅäÖÃÎļþÔÚJarºó±ä³ÉÎļþ²»´æÔڵı¾ß£¬ÏÂÔÚÌá³ö¼¸¸÷²»Í¬µÄÅäÖÃÎļþ¶ÁÈ¡·½Ê½£¬½ö¹©²Î¿¼
Ò»¡¢Ö±½ÓÎļþ¶ÁÈ¡
File f = new File("you config file path");
FileReader fr = new FileReader(f);
BufferReader br = new ......
£¨×ª£©javaÓëflexͨÐÅ
Ò»¡¢×¼±¸£º
·þÎñ¶Ë£ºJDK1.5 £¨Õâ¸ö²»ÓýéÉÜÁË°É£¿£©
·þÎñ¶ËIDE£ºeclipse £¨ËüµÄÖ÷Ò³£©
¿Í»§¶Ë£ºFLEX 3 £¨Adobe® Flex® 3 ÊÇÓÃÓÚ¹¹½¨ºÍά»¤ÔÚËùÓÐÖ÷Òªä¯ÀÀÆ÷¡¢×ÀÃæºÍ²Ù×÷ϵͳһÖµز¿ÊðµÄ¼«¾ß±íÏÖÁ¦µÄ Web Ó¦ÓóÌÐòµÄ¸ßЧÂʵĿª·ÅÔ´Âë¿ò¼Ü¡££©
¿Í»§¶ËIDE£ºFlex Builder 3 ......
jdkµÄ°²×°
1¡¢´Ójava.sun.com¸ãÏÂjdk×îеİ汾£¬Ò»°ãÎÒÃÇÓÃ1.6°æ±¾µÄ£¬ÏÂÔØbin¸ñʽµÄjdk£¬¼Ù¶¨ÏÂÔصÄÎļþÃûΪjdk-6u20-linux-i586.bin¡£
2¡¢chmod u+x jdk-6u20-linux-i586.bin;È»ºó ./jdk-6u20-linux-i586.bin ½âѹ£¬¼Ù¶¨½âѹºóµÄÎļþ¼ÐΪ jdk1.6_20;
3¡¢ÔÚ/usr/local/ ½¨Á¢Ò»¸öinstallµÄĿ¼£¬ È»ºó°Ñ½âÑ ......
send mail use smtp .u can send text or html, send to many peoples if u have a email user and pwd and the smtp of the email which u use.
package org.lc.smtp;
import java.io.IOException;
import java.util.Properties;
import javax.activation.DataHandler;
import javax.mail.Message;
import javax.mai ......
1. ActionFormÖÐÌí¼ÓÊôÐÔ£¬FormFileÀàÐͶÔÏó¡£
private FormFile upLoadFile;
public FormFile getUpLoadFile() {
return upLoadFile;
}
public void setUpLoadFile(FormFile upLoadFile) {
this.upLoadFile = upLoadFile;
}
2. Action ÖÐÔö¼ÓÐ޸ķ½·¨¡£
public ActionForward save(ActionMapping mapping, Action ......