java jdk5Öз½·¨µÄÖØÔØÓëÖØд
JavaÓïÑÔÖеĸÅÄî¾ÍÊǶ࣬Õâ»ØÓÖÓÐÁ½¸ö¸ÅÄÖØÔغÍÖØд¡£ÕâÊÇÁ½¸öиÅÄҲÊÇÁ½¸öÁî³õѧÕßÈÝÒ×»ìÏýµÄ¸ÅÄî¡£ËûÃǵĸÅÄî½ØÈ»²»Í¬£¬Ö»²»¹ý¶¼Óиö“ÖØ”×Ö£¬¾ÍÒÔΪÊǺÜÏñµÄ¡£ÏÂÃæ½âÊÍÒ»ÏÂÕâÁ½¸ö¸ÅÄ
·½·¨ÖØÔØ(overloading method) ÊÇÔÚÒ»¸öÀàÀïÃ棬·½·¨Ãû×ÖÏàͬ£¬¶ø²ÎÊý²»Í¬¡£·µ»ØÀàÐÍÄØ£¿¿ÉÒÔÏàͬҲ¿ÉÒÔ²»Í¬¡£
·½·¨ÖØд(overiding method) ×ÓÀ಻ÏëÔ·â²»¶¯µØ¼Ì³Ð¸¸ÀàµÄ·½·¨£¬¶øÊÇÏë×÷Ò»¶¨µÄÐ޸ģ¬Õâ¾ÍÐèÒª²ÉÓ÷½·¨µÄÖØд¡£·½·¨ÖØдÓֳƷ½·¨¸²¸Ç¡£Èç¹û»¹ÊǸã»ìµÄ»°£¬¾Í°Ñ“ÖØд¸²¸Ç”£¬Õâ¸ö´Ê¶àÄ±é°É¡£ÖªµÀÊǸ²¸ÇµÄ»°£¬¾ÍÖªµÀÊÇ×ÓÀา¸Ç¸¸ÀàµÄ·½·¨ÁË¡£
ʵ¼ù£º ÖØÔصÄÀý×Ó
public class MethodOverloading { void recieve(int i) { System.out.println("½ÓÊÕÒ»¸öintÊý¾Ý"); System.out.println("i="+i); } void recieve(float f) { System.out.println("½ÓÊÜÒ»¸öfloatÐ͵ÄÊý¾Ý"); System.out.println("f="+f); } void recieve(String s) { System.out.println("½ÓÊÜÒ»¸öStringÐÍÊý¾Ý"); System.out.println("s="+s); }
public static void main(String[] args){
MethodOverloading m = new MethodOverloading();
m.recieve(3456);
m.recieve(34.56);
m.recieve(“°Ù¼ÒÈÈí¼þÏîÄ¿Ñо¿ÊÒ“);
}}
´ó¼Ò¿´µ½ÁËÉÏÃæµÄÀý×Ó·½·¨receive()ÓÐÈý¸ö£¬Ãû×ÖÏàͬ²ÎÊý²»Í¬¡£ÕâÑùµÄ»°£¬ÔÚmain()µ÷ÓõÄʱºò£¬²ÎÊýÓÃÆðÀ´¾ÍºÜ·½±ãÁË¡£ÖØдµÄÀý×ÓËƺõ²»ÓþÙÁË£¬¼Ç²»×¡µÄ»°£¬¾ÍºÍ“¸²¸Ç”¡£Ò»ÆðÄî¡£
ÓÐʱºò£¬ÖØÔغÍÖØдµÄ·½Ê½ÓÐЩ¸´ÔÓ£¬ÔÚjdk5ÀïÃæ¡£ÓÐһЩ·½Ê½Äܼò»¯Ò»Ð©¡£ÎÒÃÇÀ´¿´¿´°É£¬jdk5µÄ¿É±ä²ÎÊý¡£ Èç¹û°ÑÏàͬ²ÎÊýÀàÐ͵ķ½·¨ÖØÔغü¸±éÕæµÄÊǺܷ³¡£¾ÍÒ»¸ö·½·¨£¬pri(String args), pri(String arg0 ,String arg1), pri(String arg0,String arg1,String arg2), pri(String arg0,String arg1,String arg2,String arg3)¡£ÕâÑùµÄ»°»áдºÜ¶à·³ËöµÄ´úÂë¡£ÏÖÔÚjdk5¿ÉÒÔ£¬ÓÓ…”À´´úÌæÕâЩ²ÎÊý¡£Êµ¼ù£º
public class overload {
//Èô¸É¸öÏàͬÀàÐ͵IJÎÊý£¬ÓÓ...”´úÌæ
public void pri(String... strings ){
for (String str : strings) //forÕâ¸öÑ»·Óï¾äÒ²Óеü´úµÄÒâ˼
System.out.print(str);
}
public static void main(String[] args){
new overload().pri("100jq"," °Ù¼ÒÈÈí¼þÏîÄ¿Ñо¿ÊÒ"," www.100jq.com");
}
}
jdk5µÄ·½·¨ÖØд£¬±ÈÒÔÇ°¶àÁËÒ»¸ö½Ð×öбä·
Ïà¹ØÎĵµ£º
°ÑÊ÷ÐεĽṹ³éÏóÁËһϡ£
ITree
package utility.structure.def;
/**
*
* @author odie.tang
*
* @version 1.0 10/30/09
*/
public interface ITree<E>{
E getData();
E remove();
void setData(E e);
int getDepth();
int getLevel();
ITree<E> getRoot();
......
1.JavaµÄ±àÒëÔËÐÐ
JavaÖеÄpackage¸ÅÄîÏ൱ÓÚC++ÖеÄnamespaceµÄ¸ÅÄî¡£µ«ÊÇjava»á°ÑpackageµÄÃû×ÖºÍÎļþϵͳÖÐĿ¼½á¹¹¶ÔÓ¦ÆðÀ´£¬Ò²¼´Èç¹ûÄãÉêÃ÷ÁËij¸öpackageµÄÃû×ÖΪcom.tij.everythingisobj£¬ÄÇôÄãµÄÎļþϵͳÖбØÐë´´½¨com\tij\everythingisobjÕâÑùÒ»¸ö ......
JavaÓïÑÔ·´ÉäÌṩһÖÖ¶¯Ì¬Á´½Ó³ÌÐò×é¼þµÄ¶à¹¦ÄÜ·½·¨¡£ËüÔÊÐí³ÌÐò´´½¨ºÍ¿ØÖÆÈκÎÀàµÄ¶ÔÏó(¸ù¾Ý°²È«ÐÔÏÞÖÆ)£¬ÎÞÐèÌáÇ°Ó²±àÂëÄ¿±êÀà¡£ÕâЩÌØÐÔʹµÃ·´ÉäÌرðÊÊÓÃÓÚ´´½¨ÒԷdz£ÆÕͨµÄ·½Ê½Óë¶ÔÏóÐ×÷µÄ¿â¡£ÀýÈ磬·´Éä¾³£ÔÚ³ÖÐø´æ´¢¶ÔÏóΪÊý¾Ý¿â¡¢XML»òÆäËüÍⲿ¸ñʽµÄ¿ò¼ÜÖÐʹÓá£Java reflection ·Ç³£ ......
-
Êý¾Ý¿â²¿·Ö:
1.¾ÙÀý˵Ã÷Dynamic SQLµÄÔÀí¼°Ó¦Óã¿
2.¾ÙÀý˵Ã÷Êý¾Ý¿âË÷ÒýµÄÓÅȱµã£¿
3.Èç¹ûÓÉÄãÀ´Éè¼ÆÊý¾ÝµÄrollback,ÄãµÄ˼·ºÍ·½°¸£¿
4.¼ÙÉèÓÐÒ»¸ötable£¬ÃûΪpages£¬ÓÐËĸö×Ö¶Î,id ,url,title,body¡£ÀïÃæ´¢Á˺ܶàÍøÒ³£¬ÍøÒ³µÄurlµØÖ·£¬titleºÍÍøÒ³ÄÚÈÝ£¬ÓÃÒ»¸ö
sql²éѯ½«urlÆ¥ÅäµÄÅÅÔÚ×îÇ°Ã棬titleÆ¥ÅäµÄ ......
ÔÚjavaÓïÑÔÖУ¬I/OµÄ·½Ê½ÊÇÁ÷µÄ·½Ê½¡£Á÷£¨stream£©ÕâÊǸöѧϰjavaÊäÈëÊä³öµÄ×î»ù±¾µÄ¸ÅÄî¡£Á÷ÊÇ×Ö½Ú´ÓÔ´µ½Ä¿µÄµÄÓÐÐòÐòÁС£Ò»·½ÃæÊÇ×Ö½Ú£¬Ò»·½ÃæÊÇÓÐÐòµÄ¡£Á÷ÃèÊöµÄÊÇÒ»¸ö¹ý³Ì£¬Ë³ÐòÑϸñ¡£Ò»¸öÐèÒª¼üÅÌÊäÈëµÄ³ÌÐò¿ÉÒÔÓÃÁ÷À´×öµ½ÕâÒ»µã¡£Á½ÖÖ»ù±¾µÄÁ÷ÊÇ£ºÊäÈëÁ÷ºÍÊä³öÁ÷¡£Äã¿ÉÒÔ´ÓÊäÈëÁ÷¶Á£¬µ«Äã²»ÄܶÔËüд¡£Òª´ÓÊäÈëÁ ......