JavaÃæÏò¶ÔÏó±à³Ì 6.3 ·½·¨¸²¸Ç£¨Override£©
JavaÃæÏò¶ÔÏó±à³Ì-6.3 ·½·¨¸²¸Ç£¨Override£©¼ÙÈçÓÐ100¸öÀ࣬·Ö±ðΪSub1£¬Sub2…Sub100£¬ËüÃǵÄÒ»¸ö¹²Í¬ÐÐΪÊÇд×Ö£¬³ýÁËSub1ÀàÓýÅд×ÖÍ⣬ÆäÓàµÄÀ඼ÓÃÊÖд×Ö¡£¿ÉÒÔ³éÏó³öÒ»¸ö¸¸ÀàBase£¬ËüÓÐÒ»¸ö±íʾд×ֵķ½·¨write()£¬ÄÇôÕâ¸ö·½·¨µ½µ×ÈçºÎʵÏÖÄØ£¿´Ó¾¡¿ÉÄÜÌá¸ß´úÂë¿ÉÖØÓÃÐԵĽǶȿ´£¬write()·½·¨Ó¦¸Ã²ÉÓÃÊÊÓÃÓÚ´ó¶àÊý×ÓÀàµÄʵÏÖ·½Ê½£¬ÕâÑù¾Í¿ÉÒÔ±ÜÃâÔÚ´ó¶àÊý×ÓÀàÖÐÖظ´¶¨Òåwrite()·½·¨¡£Òò´ËBaseÀàµÄwrite ()·½·¨µÄ¶¨ÒåÈçÏ£º
public void write(){ //BaseÀàµÄwrite()·½·¨
//ÓÃÊÖд×Ö
…
}
ÓÉÓÚSub1ÀàµÄд×ÖµÄʵÏÖ·½Ê½ÓëBaseÀ಻һÑù£¬Òò´ËÔÚSub1ÀàÖбØÐëÖØж¨Òåwrite()·½·¨¡£
public void write(){ //Sub1ÀàµÄwrite()·½·¨
//ÓýÅд×Ö
…
}
Èç¹ûÔÚ×ÓÀàÖж¨ÒåµÄÒ»¸ö·½·¨£¬ÆäÃû³Æ¡¢·µ»ØÀàÐͼ°²ÎÊýÇ©ÃûÕýºÃÓ븸ÀàÖÐij¸ö·½·¨µÄÃû³Æ¡¢·µ»ØÀàÐͼ°²ÎÊýÇ©ÃûÏàÆ¥Å䣬ÄÇô¿ÉÒÔ˵£¬×ÓÀàµÄ·½·¨¸²¸ÇÁ˸¸ÀàµÄ·½·¨¡£
¸²¸Ç·½·¨±ØÐëÂú×ã¶àÖÖÔ¼Êø£¬ÏÂÃæ·Ö±ð½éÉÜ¡£
£¨1£©×ÓÀà·½·¨µÄÃû³Æ¡¢²ÎÊýÇ©ÃûºÍ·µ»ØÀàÐͱØÐëÓ븸Àà·½·¨µÄÃû³Æ¡¢²ÎÊýÇ©ÃûºÍ·µ»ØÀàÐÍÒ»Ö¡£ÀýÈçÒÔÏ´úÂ뽫µ¼Ö±àÒë´íÎó¡£
public class Base {
public void method() {…}
}
public class Sub extends Base{
public int method() { //±àÒë´íÎ󣬷µ»ØÀàÐͲ»Ò»ÖÂ
return 0;
}
}
Java±àÒëÆ÷Ê×ÏÈÅжÏSubÀàµÄmethod()·½·¨ÓëBaseÀàµÄmethod()·½·¨µÄ²ÎÊýÇ©Ãû£¬ÓÉÓÚÁ½ÕßÒ»Ö£¬Òò´ËJava±àÒëÆ÷ÈÏΪSubÀàµÄmethod()·½·¨ÊÔͼ¸²¸Ç¸¸ÀàµÄ·½·¨£¬¼ÈÈ»Èç´Ë£¬SubÀàµÄmethod()·½·¨¾Í±ØÐëºÍ±»¸²¸ÇµÄ·½·¨¾ßÓÐÏàͬµÄ·µ»ØÀàÐÍ¡£
ÒÔÏ´úÂëÖÐ×ÓÀา¸ÇÁ˸¸ÀàµÄÒ»¸ö·½·¨£¬È»ºóÓÖ¶¨ÒåÁËÒ»¸öÖØÔØ·½·¨£¬ÕâÊǺϷ¨µÄ¡£
public class Base {
public void method() {…}
}
public class Sub extends Base {
public void method(){…} //¸²¸ÇBaseÀàµÄmethod()·½·¨
public int method(int a) { //ÖØÔØmethod()·½·¨
return 0;
}
}
£¨2£©×ÓÀà·½·¨²»ÄÜËõС¸¸Àà·½·¨µÄ·ÃÎÊȨÏÞ¡£ÀýÈçÒÔÏ´úÂëÖÐ×ÓÀàµÄmethod()·½·¨ÊÇ˽Óеģ¬¸¸ÀàµÄmethod()·½·¨Êǹ«¹²µÄ£¬×ÓÀàËõСÁ˸¸Àà·½·¨µÄ·ÃÎÊȨÏÞ£¬ÕâÊÇÎÞЧµÄ·½·¨¸²¸Ç£¬½«µ¼Ö±àÒë´íÎó¡£
public class Base {
public void method() {…}
}
public class Sub extends Base {
private void method() {…} //±àÒë´íÎó£¬×ÓÀà·½·¨ËõСÁ˸¸Àà·½·¨µÄ·ÃÎÊȨÏÞ
}
Ϊʲô×ÓÀà·½·¨²»ÔÊÐíËõС¸¸Àà·½·¨µÄ·ÃÎÊȨÏÞÄØ£¿ÕâÊÇÒòΪ¼Ù
Ïà¹ØÎĵµ£º
×î½üÏëʵÏÖÒ»¸öÔÚ×Ô¼ºÊÖ»úÉϲéѯºº×ÖÆ´ÒôµÄ³ÌÐò£¬ÒѾ½øÐÐÁË´ó¸Å20ÌìÁË°É¡£µ«ÊÇÉÏÖܵÄʱºòÔÚNetbeans 6.8ÖÐÔËÐгÌÐò£¬ÔÚÊä³öÖÐÏÔʾµÄÊÇ“Starting emulator in execution mode”£¬Ä£ÄâÆ÷È´Æô¶¯²»ÆðÀ´¡£È¥²é¿´°²×°µÄJavaƽ̨£¬ÏÔʾÓÐ Java ME£¬³¢ÊÔ°ÑËüɾ³ýºó£¬»µÁË£¬ÔõÁËÒ²ÎÞ·¨ÔÙ´ÎÌí¼Ó£¬Ã÷Ã÷Ö¸¶¨ÁËĿ¼£¬È´ÌáÊ¾Õ ......
Finalizer ²»¿É¼Æ»®µÄ,Ò²ÊÇΣÏÕµÄ,Ò»°ãÒ²ÊDz»±ØÒªµÄ.
²»ÄÜÔÚfinalizerÖзÅÈκÎÓëÒÀÀµÊ±¼äÏà¹ØµÄ²Ù×÷,ÒòΪÄã²»ÖªµÀËüʲôʱºò±»Ö´ÐÐ. ±ÈÈçÔÚfinalizerÖйرÕÎļþµÄ×ö·¨¾ÍÊÇ´íÎóµÄ, ¸ù¾ÝJVMµÄʵÏÖ·½Ê½²»Í¬,ÓпÉÄܵ¼Ö´ò¿ªµÄÎļþÊý¹ý¶à¶øÎÞ·¨ÔÙ´ò¿ªÎļþ.
Ò²²»ÄÜÔÚfinalizerÖиıä״̬,Èç¸øÊý¾Ý¿â½âËøµÈ.
finalizer»¹ÄÜ´øÀ´Ñ ......
package PairTestMyCode.copy;
import java.util.*;
public class PairTest2
{
public static void main(String[] args)
{
GregorianCalendar[] birthdays =
{
new GregorianCalendar(1906, Calendar.DECEMBER, 9), // G. Hopper
new GregorianCalendar(1815, Cal ......
ÔÚJSPÀ»ñÈ¡¿Í»§¶ËµÄIPµØÖ·µÄ·½·¨ÊÇ£ºrequest.getRemoteAddr()£¬ÕâÖÖ·½·¨Ôڴ󲿷ÖÇé¿ö϶¼ÊÇÓÐЧµÄ¡£µ«ÊÇÔÚͨ¹ýÁËApache,SquidµÈ·´Ïò´úÀíÈí¼þ¾Í²»ÄÜ»ñÈ¡µ½¿Í»§¶ËµÄÕæʵIPµØÖ·ÁË¡£
Èç¹ûʹÓÃÁË·´Ïò´úÀíÈí¼þ£¬½«http://192.168.1.110:2046/ µÄURL·´Ïò´úÀíΪhttp://www.xxx.com/ µÄURLʱ£¬ÓÃrequest.getRemoteAddr()·½·¨»ñÈ¡ ......
Ò»¡¢BorderLayoutTest.java
package com.briup.md08;
import java.awt.*;
import javax.swing.*;
/*BorderLayoutÌصã
1¡¢×é¼þµÄ´óСÓÉÈÝÆ÷¾ö¶¨
2¡¢ÈÝÆ÷±»»®·ÖΪ5¸öÇøÓò£¬Ã¿¸öÇøÓòÖ»ÄÜÖ±½Ó¼ÓÈë3¸ö×é¼þ
3¡¢×é¼þ¼ÓÈëµÄλÖÃÐèÒªÖ¸¶¨£¬Ä¬ÈÏΪCENTER
4¡¢×é¼þÖ®¼äĬÈÏûÓмä϶
5¡¢Èç¹û³ýCENTER ÒÔÍâµÄÇøÓòûÓмÓÈë×é¼þ£¬Æ ......