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

JavaÖÐÖØÔØºÍÖØÐ´µÄÇø±ð

1¡¢ÖØÔØ(Overloading)
£¨1£©·½·¨ÖØÔØÊÇÈÃÀàÒÔͳһµÄ·½Ê½´¦Àí²»Í¬ÀàÐÍÊý¾ÝµÄÒ»ÖÖÊֶΡ£¶à¸öͬÃûº¯Êýͬʱ
´æÔÚ£¬¾ßÓв»Í¬µÄ²ÎÊý¸öÊý/ÀàÐÍ¡£ÖØÔØOverloadingÊÇÒ»¸öÀàÖжà̬ÐÔµÄÒ»ÖÖ±íÏÖ¡£
£¨2£©JavaµÄ·½·¨ÖØÔØ£¬¾ÍÊÇÔÚÀàÖпÉÒÔ´´½¨¶à¸ö·½·¨£¬ËüÃǾßÓÐÏàͬµÄÃû×Ö£¬µ«¾ß
Óв»Í¬µÄ²ÎÊýºÍ²»Í¬µÄ¶¨Òå¡£µ÷Ó÷½·¨Ê±Í¨¹ý´«µÝ¸øËüÃǵIJ»Í¬²ÎÊý¸öÊýºÍ²ÎÊýÀàÐÍ
À´¾ö¶¨¾ßÌåʹÓÃÄĸö·½·¨, Õâ¾ÍÊǶà̬ÐÔ¡£
£¨3£©ÖØÔصÄʱºò£¬·½·¨ÃûÒªÒ»Ñù£¬µ«ÊDzÎÊýÀàÐͺ͸öÊý²»Ò»Ñù£¬·µ»ØÖµÀàÐÍ¿ÉÒÔÏàͬ
Ò²¿ÉÒÔ²»Ïàͬ¡£ÎÞ·¨ÒÔ·µ»ØÐͱð×÷ÎªÖØÔØº¯ÊýµÄÇø·Ö±ê×¼¡£
ÏÂÃæÊÇÖØÔØµÄÀý×Ó£º
package c04.answer;//ÕâÊǰüÃû
//ÕâÊÇÕâ¸ö³ÌÐòµÄµÚÒ»ÖÖ±à³Ì·½·¨£¬ÔÚmain·½·¨ÖÐÏÈ´´½¨Ò»¸öDogÀàʵÀý£¬È»ºóÔÚDog
ÀàµÄ¹¹Ôì·½·¨ÖÐÀûÓÃthis¹Ø¼ü×Öµ÷Óò»Í¬µÄbark·½·¨¡£²»Í¬µÄÖØÔØ·½·¨barkÊǸù¾ÝÆä²Î
ÊýÀàÐ͵IJ»Í¬¶øÇø·ÖµÄ¡£
 
//×¢Ò⣺³ý¹¹ÔìÆ÷ÒÔÍ⣬±àÒëÆ÷½ûÖ¹ÔÚÆäËûÈκεط½Öе÷Óù¹ÔìÆ÷¡£
package c04.answer;
 
public class Dog {
     Dog()
     {
            this.bark();
     }
     void bark()//bark()·½·¨ÊÇÖØÔØ·½·¨
     {
            System.out.println("no barking!");
            this.bark("female", 3.4);
     }
     void bark(String m,double l)//×¢Òâ£ºÖØÔØµÄ·½·¨µÄ·µ»ØÖµ¶¼ÊÇÒ»ÑùµÄ£¬
     {
            System.out.println("a barking dog!");
            this.bark(5, "China");
     }
     void bark(int a,String n)//²»ÄÜÒÔ·µ»ØÖµÇø·ÖÖØÔØ·½·¨£¬¶øÖ»ÄÜÒÔ“²ÎÊýÀàÐÍ”ºÍ“ÀàÃû”À´Çø·Ö
     {
            System.out.println("a howling dog");
     }
    
&n


Ïà¹ØÎĵµ£º

Effective Java ѧϰ±Ê¼Ç (6)

¼°Ê±Ïû³ý²»Ê¹ÓõĶÔÏóµÄÒýÓÃ, ÀíÂÛÉÏ, ´øÓÐÄÚ´æ¹ÜÀíµÄÓïÑÔÊDz»´æÔÚÄÚ´æÐ¹Â©µÄ, µ«ÊÇÈç¹û¶Ô¶ÔÏóµÄ²Ù×÷²»µ±,Ò²ÊÇ¿ÉÄÜ»áÔì³ÉÄÚ´æÐ¹Â©.
ÈçÓÐÒ»¸östack, Æäpopº¯ÊýÈçÏÂ.
public Object pop()
{
               if( Element.length() == 0) return nu ......

Effective Java ѧϰ±Ê¼Ç(8)

µ±ÖØÔØequals·½·¨Ê±,×ñÑ­¹ßÀý.
equals²»ÊÇÿ¸öÀà¶¼±ØÐëÖØÔØ,µ±ÒÔϼ¸¸öÌõ¼þÂú×ã,¿ÉÒÔ²»ÖØÔØequals.
1. ÀàµÄʵÀýÖ»ÓÐͬһ¸ö²Å±»ÅÐΪÏàµÈ. ÈçThreadÀà.
2. ²»ÓùØÐÄÁ½¸ö¶ÔÏóÊÇ·ñÂß¼­ÏàµÈµÄʱºò,»òÊÇ˵±È½Ï¶ÔÏóûÓÐÒâÒå.
3.¸¸ÀàÒѾ­ÖØÔØÁËequals,¶øÇÒ¸¸ÀàµÄequalsÒ²ÊÊÓÃÓÚ×ÓÀà,×ÓÀà¾Í²»ÓÃÖØÔØequals.
4.ÕâÊÇÒ»¸ö˽ÓÐÀà»òÊ ......

JavaÃæÏò¶ÔÏó±à³Ì 6.3 ·½·¨¸²¸Ç£¨Override£©

JavaÃæÏò¶ÔÏó±à³Ì-6.3 ·½·¨¸²¸Ç£¨Override£©¼ÙÈçÓÐ100¸öÀ࣬·Ö±ðΪSub1£¬Sub2…Sub100£¬ËüÃǵÄÒ»¸ö¹²Í¬ÐÐΪÊÇд×Ö£¬³ýÁËSub1ÀàÓýÅд×ÖÍ⣬ÆäÓàµÄÀà¶¼ÓÃÊÖд×Ö¡£¿ÉÒÔ³éÏó³öÒ»¸ö¸¸ÀàBase£¬ËüÓÐÒ»¸ö±íʾд×ֵķ½·¨write()£¬ÄÇôÕâ¸ö·½·¨µ½µ×ÈçºÎʵÏÖÄØ£¿´Ó¾¡¿ÉÄÜÌá¸ß´úÂë¿ÉÖØÓÃÐԵĽǶȿ´£¬write()·½·¨Ó¦¸Ã²ÉÓÃÊÊÓÃÓÚ´ó ......

Java Web Service Apache CXF ѧϰ

    ÏîÄ¿ÖÐÓõ½web service£¬ÓÚÊÇÑо¿Á˶þÌ죬ÏÂÃæ¸ù¾ÝÕâ¶þÌìÓõ½µÄ×ܽáһϣ¬µ±È»×î¶àµÄ»¹ÊǸù¾Ýapache cxf¹ÙÍøÎĵµhttp://cxf.apache.org ¿´Îĵµ£¬µ±È»Ò²²»ÊǶ¼¿´£¬Ö»¿´ÁË×Ô¼ºÐèÒªµÄ¡£
»ù´¡ÖªÊ¶Ñ§Ï°—— Hello Demo
    Hello Demo¿ªÊ¼ÁË£¡
µÚÒ»£¬Ð½¨HelloDemo Web ÏîÄ ......

Java¶àÏß³ÌÖ®ThreadLocal_1

ThreadLocalµÄºËÐÄ˼ÏëºÜ¼òµ¥£ºÎªÃ¿¸ö¶ÀÁ¢µÄÏß³ÌÌṩһ¸ö±äÁ¿µÄ¸±±¾¡£
    ThreadLocalÔòʹÓÃÁË“¿½±´¸±±¾”µÄ·½Ê½£¬ÈËÈËÓзݣ¬ÄãÓÃÄãµÄ£¬ÎÒÓÃÎҵ쬴ó¼Ò»¥²»Ó°Ï죬ÊÇ“ÒԿռ任ʱ¼ä”¡£Ã¿¸öÏß³ÌÐ޸ıäÁ¿Ê±£¬Êµ¼ÊÉÏÐ޸ĵÄÊDZäÁ¿µÄ¸±±¾£¬²»ÅÂÓ°Ïìµ½ÆäËüÏ̡߳£
 
  & ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ