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() {…} //±àÒë´íÎó£¬×ÓÀà·½·¨ËõСÁ˸¸Àà·½·¨µÄ·ÃÎÊȨÏÞ
}
Ϊʲô×ÓÀà·½·¨²»ÔÊÐíËõС¸¸Àà·½·¨µÄ·ÃÎÊȨÏÞÄØ£¿ÕâÊÇÒòΪ¼Ù
Ïà¹ØÎĵµ£º
javaÖеÄËÄÖÖÀàÐ͵ļ¯ºÏÀà
£¨1£©Vector £¨2£©BitSet£¨3£©Stack£¨4£©HashTable
2ö¾ÙÆ÷
ÔÚÈκμ¯ºÏÀàÖУ¬±ØÐëͨ¹ýijÖÖ·½·¨ÔÚÆäÖÐÖÃÈë¶ÔÏó£¬ÔÙÓÃÁíÒ»ÖÖ·½·¨´ÓÖÐÈ¡µÃ¶ÔÏó¡£ÔÚVectorÖУ¬addElement()¾ÍÊÇÎÒÃDzåÈë¶ÔÏó²ÉÓõķ½·¨
£¬¶þelementAt()ÔòÊÇÌáÈ¡¶ÔÏóµÄΨһ·½·¨¡£
Iterator¿ÉÒÔ´ïµ½Õâ¸öÄ¿µÄ£¬ËüÊÇÒ»¸ö¶ÔÏó£¬×÷ÓÃÊDZ ......
×î½üÒ»¶Îʱ¼ä¿´µ½ÁËylmf os һʱÊÖÑ÷°²×°ÁË¡£×¼±¸°ÑʹÓÃÖÐÓöµ½µÄÎÊÌâ½øÐмǼ£¬Òѱ»²»Ê±Ö»Ðè¡£
°²×°java·½·¨2ÖÖ£º
µÚÒ»ÖÖ£¬ÔÚÖÕ¶ËÖ´ÐÐÃüÁî½øÐÐÏÂÔØ¡£
´ò¿ªÖնˣ¬Ö´ÐÐÒÔÏÂÃüÁϵͳ»á×Ô¶¯ÏÂÔØJDK £¬²¢°²×°¡£
sudo apt-get install sun-java6-jdk
Èç¹û¿Õ¼ä²»¸»Ô£µÄ»°£¬¿ÉÒÔÖ»×°JRE
sudo apt-get install sun-java6- ......
Ò»¡¢Servlet¹ýÂËÆ÷µÄ¸ÅÄ
*******************************************************
Servlet¹ýÂËÆ÷ÊÇÔÚJava Servlet¹æ·¶2.3Öж¨ÒåµÄ£¬ËüÄܹ»¶ÔServletÈÝÆ÷µÄÇëÇóºÍÏìÓ¦¶ÔÏó½øÐмì²éºÍÐ޸ġ£¡¡¡¡¡¡
Servlet¹ýÂËÆ÷±¾Éí²¢²»²úÉúÇëÇóºÍÏìÓ¦¶ÔÏó£¬ËüÖ»ÄÜÌṩ¹ýÂË×÷Óá£Servlet¹ýÆÚÄܹ»ÔÚServlet±»µ÷ÓÃ֮ǰ¼ì²éRequest¶ÔÏó£ ......
ÔÚJSPÀ»ñÈ¡¿Í»§¶ËµÄIPµØÖ·µÄ·½·¨ÊÇ£ºrequest.getRemoteAddr()£¬ÕâÖÖ·½·¨Ôڴ󲿷ÖÇé¿ö϶¼ÊÇÓÐЧµÄ¡£µ«ÊÇÔÚͨ¹ýÁËApache,SquidµÈ·´Ïò´úÀíÈí¼þ¾Í²»ÄÜ»ñÈ¡µ½¿Í»§¶ËµÄÕæʵIPµØÖ·ÁË¡£
Èç¹ûʹÓÃÁË·´Ïò´úÀíÈí¼þ£¬½«http://192.168.1.110:2046/ µÄURL·´Ïò´úÀíΪhttp://www.xxx.com/ µÄURLʱ£¬ÓÃrequest.getRemoteAddr()·½·¨»ñÈ¡ ......
ÔÚjavaÏîÄ¿Öе¼Èëweka.jarµÄ°ü,È»ºó°ÑÏÂÃæ´úÂëcopyµ½mainÀïÃæ,
ÓÃeclipseµÄ»°×Ô¶¯import°É.
×¢ÒâÒ»ÏÂÄǸöÎļþµÄ·¾¶ÊÇ·ñÕýÈ·.
import
java.io.File;
import
weka.classifiers.Classifier;
import
weka.classifiers.trees.J48;
import
weka.core.Instances;
import
weka.core.converters.ArffLoader;
½ ......