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

¡¾·Ü¶·µÚÈýÌì¡¿²ËÄñѧJavaÖ®Òì³£´¦Àí

½ñÌìÒ»ÌìѧÁËÒì³£´¦ÀíÕâÒ»Õ¡£
Ê×ÏÈÒì³£ÊÇJava³ÌÐòÔÚÔËÐÐÆÚ³öÏֵĴíÎ󣬷DZàÒëÆÚ£¨javac£©³öÏֵĴíÎó¡£
È»ºóÔÙ¸øÒì³£·ÖÀ࣬Òì³£·ÖΪÈýÖÖ£¬µÚһΪerror£¬ÕâÖÖÒì³£²»¿ÉÒÔ´¦Àí£¬ÊÇϵͳµÄÄÚ²¿´íÎ󣬵ڶþΪException£¬ÕâÖÖ¿ÉÒÔ±»´¦Àí£¬ExceptionÀïÃæÓÖÓиöRuntimeExceptionµÄÀ࣬¶øRuntimeExceptionÓÖÊÇ¿ÉÒÔ²»±»²¶»ñ´¦ÀíµÄ£¬ÒòΪËü¾­³£³öÏÖ£¬java¿ÉÒÔ×Ô¶¯Å׳ö´¦Àí¡£ËùÒÔÎÒÃÇ´ó¶àÊýÇé¿öÏÂÖ»¹Ø×¢ExceptionÖеķÇRuntimeExceptionµÄÒì³£¡£
Òì³£ÖÐÖ÷ÒªµÄ¹Ø¼ü×Ö£º
try catch fiÕâÁ½¸ö¹Ø¼ü×ÖÓÃÀ´²¶»ñ´¦ÀíÒì³£
try{
.......
}catch(){
.......
}
ÒÔÏÂÌÖÂÛthrowsºÍthrow¹Ø¼ü×Ö
ÒÔÏÂÎª×ªÔØ×ª×Ôhttp://jieming.javaeye.com/blog/455743
throwµÄ×÷ÓÃ
ÊÖ¶¯Å׳öÒì³£
µ«ÊÇÓÐʱºòÓÐЩ´íÎóÔÚjvm¿´À´²»ÊÇ´íÎ󣬱ÈÈç˵
int age = 0;
age = -100;
System.out.println(age);
    ºÜÕý³£µÄÕûÐαäÁ¿¸³Öµ£¬µ«ÊÇÔÚÎÒÃÇÑÛÖп´À´¾Í²»Õý³££¬Ë­µÄÄêÁä»áÊǸºµÄÄØ¡£ ËùÒÔÎÒÃÇÐèÒª×Ô¼ºÊÖ¶¯Òý·¢Òì³££¬Õâ¾ÍÊÇthrowµÄ×÷Óá£
int age = 0;
age = -100;
if(age<0)
{
   Exception e = new Exception("throw exception");//´´½¨Òì³£¶ÔÏó
   throw e;//Å׳öÒì³£
}
System.out.println(age);
throwsµÄ×÷ÓÃ
ÉùÃ÷·½·¨¿ÉÄܻرܵÄÒì³£
    ÓÐÒì³£±»Å׳öÁË£¬¾ÍÒª×ö´¦Àí£¬ËùÒÔjavaÖÐÓÐtry-catch¡£¿ÉÊÇÓÐʱºòÒ»¸ö·½·¨ÖвúÉúÁËÒì³££¬µ«ÊDz»ÖªµÀ¸ÃÔõô´¦ÀíËü£¬ÄÇô¾Í·Å×Ų»¹Ü£¬µ±ÓÐÒì³£ Å׳öʱ»áÖжϸ÷½·¨£¬¶øÒì³£±»Å×µ½Õâ¸ö·½·¨µÄµ÷ÓÃÕßÄÇÀï¡£Õâ¸öÓеãÏñÏÂÊô´¦Àí²»Á˵ÄÎÊÌâ¾Í½»µ½ÉÏ˾ÊÖÀïÒ»Ñù£¬ÕâÖÖÇé¿ö³ÆÎª»Ø±ÜÒì³£¡£
   µ«ÊÇÕâʹµÃµ÷ÓÃÕâ¸ö·½·¨¾ÍÓÐÁËΣÏÕ£¬ÒòΪ˭Ҳ²»ÖªµÀÕâ¸ö·½·¨Ê²Ã´Ê±ºò»á¶ªÒ»¸öʲôÑùµÄÒì³£¸øµ÷ÓÃÕߣ¬ËùÒÔÔÚ¶¨Òå·½·¨Ê±£¬¾ÍÐèÒªÔÚ·½·¨Í·²¿·ÖʹÓÃthrowsÀ´ÉùÃ÷Õâ¸ö·½·¨¿ÉÄܻرܵÄÒì³£¡£
void fun()throws IOException,SQLException
{
...
}
Õâ±íʾ fun·½·¨¿ÉÄܻᶪÁ½¸öÒì³£³öÀ´£¬ÄÇôÔÚµ÷ÓÃfunµÄʱºò¾Í»á×öºÃ×¼±¸£¬±ÈÈç¿ÉÒÔÕâÑù
try{
   fun();
}catch(IOException e) { }
catch(SQLException e) { }


Ïà¹ØÎĵµ£º

JavaµÄÀ༯


Collection:ÊÇ´æ·ÅÒ»×éµ¥ÖµµÄ×î´ó½Ó¿Ú£¬Ã¿¸öÖµ¶¼ÊÇÒ»¸ö¶ÔÏó£¬Ò»°ã²»»áÖ±½ÓʹÓÃCollection½Ó¿Ú
List£ºÊÇCollectionµÄ×Ó½Ó¿Ú£¬¶ÔCollection½øÐÐÁË´óÁ¿µÄÀ©³ä£¬ÀïÃæ´æ·ÅµÄÄÚÈÝ¿ÉÒÔÖØ¸´
Set£ºÊÇCollectionµÄ×ÓÀ࣬ûÓжÔCollection½øÐÐÀ©³ä£¬ÀïÃæ´æ·ÅµÄÄÚÈݲ»ÔÊÐíÖØ¸´
Map£ºÊÇ´æ·ÅÒ»¶ÔÖµµÄ×î´ó½Ó¿Ú£¬½Ó¿ÚÖÐÿ¸öÔªËØ¶¼ÊÇÒ»¶ ......

javaµÄÏà¹Ø¼¼Êõ

     1¡¢JDBC£¨Java Database Connectivity£©ÌṩÁ¬½Ó¸÷ÖÖ¹ØÏµÊý¾Ý¿âµÄͳһ½Ó¿Ú¡£
¡¡¡¡2¡¢EJB(Enterprise JavaBeans)ʹµÃ¿ª·¢Õß·½±ãµØ´´½¨¡¢²¿ÊðºÍ¹ÜÀí¿çƽ̨µÄ»ùÓÚ×é¼þµÄÆóÒµÓ¦Óá£
¡¡¡¡3¡¢Java RMI(Java Remote Method Invocation)ÓÃÀ´¿ª·¢·Ö²¼Ê½JavaÓ¦ÓóÌÐò¡£Ò»¸öJava¶ÔÏóµÄ·½·¨Äܱ»Ô¶³ÌJavaÐéÄâ ......

JavaÖжÔÏóµÄÉúÃüÖÜÆÚ

  £¨1£© ¶ÔÏóÉúÃüÖÜÆÚµÄ¿ªÊ¼
             ¶ÔÏóÉúÃüÖÜÆÚ¿ªÊ¼Ê±£¬ÐèҪΪ¶ÔÏó·ÖÅäÄڴ棬²¢ÇÒ³õʼ»¯ËüµÄʵÀý±äÁ¿£»
           ¶ÔÏóÉúÃüÖÜÆÚ½áÊø
        & ......

JavaµÄThreadLocalÀàµÄʹÓÃ~~~~~~~~~~~~~~~~~

×ªÔØ×Ô£ºhttp://chenpingtai2008.javaeye.com/blog/253339
ÔçÔÚJava
1.2ÍÆ³ö֮ʱ£¬Javaƽ̨ÖоÍÒýÈëÁËÒ»¸öеÄÖ§³Ö£ºjava.lang.ThreadLocal£¬¸øÎÒÃÇÔÚ±àд¶àÏ̳߳ÌÐòʱÌṩÁËÒ»ÖÖеÄÑ¡Ôñ¡£Ê¹ÓÃ
Õâ¸ö¹¤¾ßÀà¿ÉÒԺܼò½àµØ±àд³öÓÅÃÀµÄ¶àÏ̳߳ÌÐò£¬ËäÈ»ThreadLocal·Ç³£ÓÐÓ㬵«ÊÇËÆºõÏÖÔÚÁ˽âËü¡¢Ê¹ÓÃËüµÄÅóÓÑ»¹²»¶à¡£
¡¡ ......

JavaÖÐtoArrayµÄÓ÷¨Ì½¾¿


Ò»£®             Incident
import java.util.ArrayList;  
import java.util.List;  
public class Test {  
    public static void main(String[] args) {  
     ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ