[ת]java³éÏóÀàºÍ½Ó¿ÚµÄÇø±ð Ïêϸ½â˵
¹Ø¼ü×Ö: java³éÏóÀàºÍ½Ó¿ÚµÄÇø±ð---Ïêϸ½â˵
abstract classºÍinterfaceÊÇJavaÓïÑÔÖжÔÓÚ³éÏóÀඨÒå½øÐÐÖ§³ÖµÄÁ½ÖÖ»úÖÆ£¬ÕýÊÇÓÉÓÚÕâÁ½ÖÖ»úÖƵĴæÔÚ£¬²Å¸³ÓèÁËJavaÇ¿´óµÄÃæÏò¶ÔÏóÄÜÁ¦¡£abstract classºÍinterfaceÖ®¼äÔÚ¶ÔÓÚ³éÏóÀඨÒåµÄÖ§³Ö·½Ãæ¾ßÓкܴóµÄÏàËÆÐÔ£¬ÉõÖÁ¿ÉÒÔÏ໥Ìæ»»£¬Òò´ËºÜ¶à¿ª·¢ÕßÔÚ½øÐгéÏóÀඨÒåʱ¶ÔÓÚabstract classºÍinterfaceµÄÑ¡ÔñÏԵñȽÏËæÒâ¡£Æäʵ£¬Á½ÕßÖ®¼ä»¹ÊÇÓкܴóµÄÇø±ðµÄ£¬¶ÔÓÚËüÃǵÄÑ¡ÔñÉõÖÁ·´Ó³³ö¶ÔÓÚÎÊÌâÁìÓò±¾ÖʵÄÀí½â¡¢¶ÔÓÚÉè¼ÆÒâͼµÄÀí½âÊÇ·ñÕýÈ·¡¢ºÏÀí¡£±¾ÎĽ«¶ÔËüÃÇÖ®¼äµÄÇø±ð½øÐÐÒ»·¬ÆÊÎö£¬ÊÔͼ¸ø¿ª·¢ÕßÌṩһ¸öÔÚ¶þÕßÖ®¼ä½øÐÐÑ¡ÔñµÄÒÀ¾Ý¡£
Àí½â³éÏóÀà
¡¡¡¡abstract classºÍinterfaceÔÚJavaÓïÑÔÖж¼ÊÇÓÃÀ´½øÐгéÏóÀࣨ±¾ÎÄÖеijéÏóÀಢ·Ç´Óabstract class·Òë¶øÀ´£¬Ëü±íʾµÄÊÇÒ»¸ö³éÏóÌ壬¶øabstract classΪJavaÓïÑÔÖÐÓÃÓÚ¶¨Òå³éÏóÀàµÄÒ»ÖÖ·½·¨£¬Çë¶ÁÕß×¢ÒâÇø·Ö£©¶¨ÒåµÄ£¬ÄÇôʲôÊdzéÏóÀ࣬ʹÓóéÏóÀàÄÜΪÎÒÃÇ´øÀ´Ê²Ã´ºÃ´¦ÄØ£¿
¡¡¡¡ÔÚÃæÏò¶ÔÏóµÄ¸ÅÄîÖУ¬ÎÒÃÇÖªµÀËùÓеĶÔÏó¶¼ÊÇͨ¹ýÀàÀ´Ãè»æµÄ£¬µ«ÊÇ·´¹ýÀ´È´²»ÊÇÕâÑù¡£²¢²»ÊÇËùÓеÄÀ඼ÊÇÓÃÀ´Ãè»æ¶ÔÏóµÄ£¬Èç¹ûÒ»¸öÀàÖÐûÓаüº¬×ã¹»µÄÐÅÏ¢À´Ãè»æÒ»¸ö¾ßÌåµÄ¶ÔÏó£¬ÕâÑùµÄÀà¾ÍÊdzéÏóÀà¡£³éÏóÀàÍùÍùÓÃÀ´±íÕ÷ÎÒÃÇÔÚ¶ÔÎÊÌâÁìÓò½øÐзÖÎö¡¢Éè¼ÆÖеóöµÄ³éÏó¸ÅÄÊǶÔһϵÁп´ÉÏÈ¥²»Í¬£¬µ«ÊDZ¾ÖÊÉÏÏàͬµÄ¾ßÌå¸ÅÄîµÄ³éÏó¡£±ÈÈ磺Èç¹ûÎÒÃǽøÐÐÒ»¸öͼÐαà¼Èí¼þµÄ¿ª·¢£¬¾Í»á·¢ÏÖÎÊÌâÁìÓò´æÔÚ×ÅÔ²¡¢Èý½ÇÐÎÕâÑùһЩ¾ßÌå¸ÅÄËüÃÇÊDz»Í¬µÄ£¬µ«ÊÇËüÃÇÓÖ¶¼ÊôÓÚÐÎ×´ÕâÑùÒ»¸ö¸ÅÄÐÎ×´Õâ¸ö¸ÅÄîÔÚÎÊÌâÁìÓòÊDz»´æÔڵģ¬Ëü¾ÍÊÇÒ»¸ö³éÏó¸ÅÄî¡£ÕýÊÇÒòΪ³éÏóµÄ¸ÅÄîÔÚÎÊÌâÁìÓòûÓжÔÓ¦µÄ¾ßÌå¸ÅÄËùÒÔÓÃÒÔ±íÕ÷³éÏó¸ÅÄîµÄ³éÏóÀàÊDz»Äܹ»ÊµÀý»¯µÄ¡£
¡¡¡¡ÔÚÃæÏò¶ÔÏóÁìÓò£¬³éÏóÀàÖ÷ÒªÓÃÀ´½øÐÐÀàÐÍÒþ²Ø¡£ÎÒÃÇ¿ÉÒÔ¹¹Ôì³öÒ»¸ö¹Ì¶¨µÄÒ»×éÐÐΪµÄ³éÏóÃèÊö£¬µ«ÊÇÕâ×éÐÐΪȴÄܹ»ÓÐÈÎÒâ¸ö¿ÉÄܵľßÌåʵÏÖ·½Ê½¡£Õâ¸ö³éÏóÃèÊö¾ÍÊdzéÏóÀ࣬¶øÕâÒ»×éÈÎÒâ¸ö¿ÉÄܵľßÌåʵÏÖÔò±íÏÖΪËùÓпÉÄܵÄÅÉÉúÀࡣģ¿é¿ÉÒÔ²Ù×÷Ò»¸ö³éÏóÌå¡£ÓÉÓÚÄ£¿éÒÀÀµÓÚÒ»¸ö¹Ì¶¨µÄ³éÏóÌ壬Òò´ËËü¿ÉÒÔÊDz»ÔÊÐíÐ޸ĵģ»Í¬Ê±£¬Í¨¹ý´ÓÕâ¸ö³éÏóÌåÅÉÉú£¬Ò²¿ÉÀ©Õ¹´ËÄ£¿éµÄÐÐΪ¹¦ÄÜ¡£ÊìϤOCPµÄ¶ÁÕßÒ»¶¨ÖªµÀ£¬ÎªÁËÄܹ»ÊµÏÖÃæÏò¶ÔÏóÉè¼ÆµÄÒ»¸ö×îºËÐĵÄÔÔòOCP(Open-Closed Principle)£¬³éÏóÀàÊÇÆäÖеĹؼüËùÔÚ¡£
´ÓÓï·¨¶¨Òå²ãÃæ¿´abstract classºÍinterface
ÔÚÓï·¨²ãÃ棬JavaÓïÑÔ¶ÔÓÚabstract classºÍinterface¸ø³öÁ˲»Í¬µÄ¶¨Ò
Ïà¹ØÎĵµ£º
JAVA´úÂë²é´í
1.
abstract class Name {
private String name;
public abstract boolean isStupidName(String name) {}
}
´óÏÀÃÇ£¬ÕâÓкδíÎó?
´ð°¸: ´í¡£abstract method±ØÐëÒԷֺŽá⣬ÇÒ²»´ø»¨À¨ºÅ¡£
2.
public class Something {
void doSomething () {
......
JAVAºìºÚÊ÷
¸ÅÄÿ¸ö½Úµã¶¼´øÓÐÑÕÉ«ÊôÐԵĶþ²æ²éÕÒÊ÷£¬ÑÕÉ«»òºìÉ«»òºÚÉ«;
ÌØÐÔ£º
ÐÔÖÊ1. ½ÚµãÊǺìÉ«»òºÚÉ«¡£
¡¡¡¡ÐÔÖÊ2. ¸ùÊǺÚÉ«¡£
¡¡¡¡ÐÔÖÊ3. ÿ¸öºìÉ«½ÚµãµÄÁ½¸ö×ӽڵ㶼ÊǺÚÉ«¡£(´Óÿ¸öÒ¶×Óµ½¸ùµÄËùÓз¾¶Éϲ»ÄÜÓÐÁ½¸öÁ¬ÐøµÄºìÉ«½Úµã)
¡¡¡¡ÐÔÖÊ4. ´ÓÈÎÒ»½Úµãµ½Æäÿ¸öÒ¶×ÓµÄËùÓз¾¶¶¼°üº¬ÏàͬÊýÄ¿µÄºÚÉ«½Úµã¡£
......
*******************************************************************************************************
Filename: ftp.java
Author: leetsing(elove)
Create date: 2004-08-30
Use: connect to FTP server,then upload and download file
Modify date: 2004-09-05 add to upload file
2004-09-13 add to downl ......
Java EE ¸ÅÊö
Javaa EE:·Ö²¼Ê½ ÆóÒµ¼¶Ó¦Óù淶ºÍ±ê×¼
ÍÆģʽ£º²»ÓÃÇëÇó£¬Ç¿ÖÆÈÿͻ§½ÓÊÜ
Àģʽ£ºÈÿͻ§ÇëÇóºÍÏìÓ¦¡£
¼Ü¹¹£º
ÇáÁ¿¼¶£ºstruct2 /spring /hibernate
Modle1:jsp+JavaBean+DB
Model2(MVC):jsp+servlet+JavaBean+DB
ÖØÁ¿¼¶£ºJsp+servlet+EJB+DB
±íʾ²ã£ºÒµÎñ²ã£º³Ö¾Ã²ã£ºÊý¾Ý¿â£º
JNDI£º²éÕÒ·Ö²¼¶ÔÏóµ ......
1 ÒýÑÔ
JavaµÄÒ»¸öÖØÒªÓŵã¾ÍÊÇͨ¹ýÀ¬»øÊÕ¼¯Æ÷GC £¨Garbage Collection£©×Ô¶¯¹ÜÀíÄÚ´æµÄ»ØÊÕ£¬³ÌÐòÔ±²»ÐèҪͨ¹ýµ÷Óú¯ÊýÀ´ÊÍ·ÅÄÚ´æ¡£Òò´Ë£¬ºÜ¶à³ÌÐòÔ±ÈÏΪJava ²»´æÔÚÄÚ´æй©ÎÊÌ⣬»òÕßÈÏΪ¼´Ê¹ÓÐÄÚ´æй©Ҳ²»ÊdzÌÐòµÄÔðÈΣ¬¶øÊÇGC »òJVMµÄÎÊÌâ¡£Æäʵ£¬ÕâÖÖÏë·¨ÊDz»ÕýÈ·µÄ£¬ÒòΪJava Ò²´æÔÚÄÚ´æ ......