java ÖØÐ´ÓëÖØÔØ
ÖØÐ´µÄÖ÷ÒªÓŵãÊÇÄܹ»¶¨Òå×ÓÀàÌØÓеÄÌØÕ÷: Èç:
public class Father{
public void speak(){
System.out.println("Father");
}
}
public class Son extends Father{
public void speak(){
System.out.println("son");
}
}
ÕâÒ²½Ð×ö¶à̬ÐÔ,ÖØÐ´·½·¨Ö»ÄÜ´æÔÚÓÚ¾ßÓм̳йØÏµµÄÀàÖÐ,ÖØÐ´·½·¨Ö»ÄÜÖØÐ´¸¸Àà·Ç˽Óеķ½·¨,µ±ÉÏÀýÖÐFatherÀàµÄspeak()·½·¨
Ϊprivateʱ,SonÀ಻ÄÜÖØÐ´speak()·½·¨,´ËʱÔÚSonÀàÖж¨ÒåµÄspeak()·½·¨Ï൱ÓÚÒ»¸öÐµķ½·¨£¬ÓëFatherÖеÄspeak()·½·¨
ûÓÐÈκιØÏµ. µ±FatherÀàµÄspeak()·½·¨ÉùÃ÷Ϊfinalʱ,ÎÞÂ۸÷½·¨µÄÐÞÊηûÊÇpublic,protected»¹ÊÇĬÈÏ,
SonÀà¸ù±¾²»ÄÜÖØÐ´speak()·½·¨,ÊÔͼ±àÒë´úÂëʱ,±àÒëÆ÷»á±¨´í.Àý:
public class Father{
final void speak(){
System.out.println("Father");
}
}
public class Son extends Father{
public void speak(){
System.out.println("son");
}
}//±àÒëÆ÷´íÎóÐÅÏ¢£ºSon ÖÐµÄ speak() ÎÞ·¨¸²¸Ç Father ÖÐµÄ speak()£»±»¸²¸ÇµÄ·½·¨Îª final ÖØÐ´·½·¨µÄ¹æÔò:
1.²ÎÊýÁÐ±í±ØÐëÍêÈ«Óë±»ÖØÐ´µÄ·½·¨µÄÏàͬ,·ñÔò²»ÄÜ³ÆÆäÎªÖØÐ´¶øÊÇÖØÔØ£»
2.·µ»ØµÄÀàÐͱØÐëÒ»Ö±Óë±»ÖØÐ´µÄ·½·¨µÄ·µ»ØÀàÐÍÏàͬ,·ñÔò²»ÄÜ³ÆÆäÎªÖØÐ´¶øÊÇÖØÔØ£»
3.·ÃÎÊÐÞÊηûµÄÏÞÖÆÒ»¶¨Òª´óÓÚ±»ÖØÐ´·½·¨µÄ·ÃÎÊÐÞÊηû£¨public>protected>default>private£©£»
4.ÖØÐ´·½·¨Ò»¶¨²»ÄÜÅ׳öеļì²éÒì³£»òÕ߱ȱ»ÖØÐ´·½·¨ÉêÃ÷¸ü¼Ó¿í·ºµÄ¼ì²éÐÍÒì³££®
ÀýÈ磺 ¸¸ÀàµÄÒ»¸ö·½·¨ÉêÃ÷ÁËÒ»¸ö¼ì²éÒì³£IOException£¬ÔÚÖØÐ´Õâ¸ö·½·¨Ê±¾Í²»ÄÜÅ׳öException£¬Ö»ÄÜÅ׳öIOExceptionµÄ×ÓÀàÒì³££¬¿ÉÒÔÅ׳ö·Ç¼ì²éÒì³££¨unchecked exception£¬ÈçÔËÐÐʱÒì³££©.
ÖØÔØ·½·¨µÄ¹æÔò£º 1.±ØÐë¾ßÓв»Í¬µÄ²ÎÊýÁÐ±í£» 2.¿ÉÒÔÓв»Í¬µÄ·µ»ØÀàÐÍ£¬Ö»Òª²ÎÊýÁÐ±í²»Í¬¾Í¿ÉÒÔÁË£» 3.¿ÉÒÔÓв»Í¬µÄ·ÃÎÊÐÞÊηû£» 4.¿ÉÒÔÅ׳ö²»Í¬µÄÒì³££»
ʾÀý£º public class Father{
public void speak(){
System.out.println("Father");
}
public void speak(String info){
System.out.println("Father speak:" + info);
}
}
Ïà¹ØÎĵµ£º
native¹Ø¼ü×ÖÓ÷¨
nativeÊÇÓëC++ÁªºÏ¿ª·¢µÄʱºòÓõģ¡java×Ô¼º¿ª·¢²»Óõģ¡
ʹÓÃnative¹Ø¼ü×Ö˵Ã÷Õâ¸ö·½·¨ÊÇÔÉúº¯Êý£¬Ò²¾ÍÊÇÕâ¸ö·½·¨ÊÇÓÃC/C++ÓïÑÔʵÏֵ쬲¢ÇÒ±»±àÒë³ÉÁËDLL£¬ÓÉjavaÈ¥µ÷Óá£
ÕâЩº¯ÊýµÄʵÏÖÌåÔÚDLLÖУ¬JDKµÄÔ´´úÂëÖв¢²»°üº¬£¬ÄãÓ¦¸ÃÊÇ¿´²»µ½µÄ¡£¶ÔÓÚ²»Í¬µÄƽ̨ËüÃÇÒ²ÊDz»Í¬µÄ¡£ÕâÒ²ÊÇjavaµÄµ×²ã»úÖÆ£ ......
1¡¢
PermGen spaceµÄÈ«³ÆÊÇPermanent Generation space,ÊÇÖ¸ÄÚ´æµÄÓÀ¾Ã±£´æÇøÓòOutOfMemoryError: PermGen space´Ó±íÃæÉÏ¿´¾ÍÊÇÄÚ´æÒæ³ö£¬½â¾ö·½·¨Ò²Ò»¶¨ÊǼӴóÄڴ档˵˵Ϊʲô»áÄÚ´æÒæ³ö£ºÕâÒ»²¿·ÖÓÃÓÚ´æ·ÅClassºÍMetaµÄÐÅÏ¢,ClassÔÚ±» LoadµÄʱºò±»·ÅÈëPermGen spaceÇøÓò£¬ËüºÍºÍ´æ·ÅInstanceµÄHeapÇøÓò²»Í¬,GC(Garba ......
http://www.goceanedu.com.cn/Read_1855.htm
ÔÚ°Ñjdk°²×°µ½¼ÆËã»úÖÐÖ®ºó£¬ÎÒÃÇÀ´½øÐÐÉèÖÃʹjava»·¾³Äܹ»Ê¹Óá£
Ê×ÏÈÓÒ¼üµãÎҵĵçÄÔ¡£´ò¿ªÊôÐÔ¡£È»ºóÑ¡Ôñ“¸ß¼¶”ÀïÃæµÄ“»·¾³±äÁ¿”£¬ÔÚеĴò¿ª½çÃæÖеÄϵͳ±äÁ¿ÐèÒªÉèÖÃÈý¸öÊôÐÔ“JAVA_HOME”¡¢
“path”¡¢“classpat ......
/**
* JavaExec.java version 1.0 Feb 22, 2010
*/
import java.lang.Runtime;
import java.lang.Process;
import java.io.InputStreamReader;
import java.lang.Exception;
import java.io.*;
public class JavaExec {
/**
* @param args
* @author Eric Yang
* @
* ......