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

JAVA ÏòÉÏתÐÍÓëÏòÏÂתÐÍ

Ò»¡¢ÏòÉÏתÐÍ¡£
ͨË׵ؽ²¼´Êǽ«×ÓÀà¶ÔÏóתΪ¸¸Àà¶ÔÏó¡£´Ë´¦¸¸Àà¶ÔÏó¿ÉÒÔÊǽӿڡ£
1£¬ÏòÉÏתÐÍÖеķ½·¨µ÷Óá£
¿´ÏÂÃæ´úÂ룺
package com.wensefu.others;
public class Animal {

public void eat(){
System.out.println("animal eatting...");
}
}
class Bird extends Animal{

public void eat(){
System.out.println("bird eatting...");
}

public void fly(){

System.out.println("bird flying...");
}
}
class Main{

public static void main(String[] args) {

Animal b=new Bird(); //ÏòÉÏתÐÍ
b.eat();
//! error: b.fly(); bËäÖ¸Ïò×ÓÀà¶ÔÏ󣬵«´Ëʱ¶ªÊ§fly()·½·¨
dosleep(new Male());
dosleep(new Female());
}

public static void dosleep(Human h) {
h.sleep();
}
}
package com.wensefu.others;
public class Human {
public void sleep() {
System.out.println("Human sleep..");
}
}
class Male extends Human {
@Override
public void sleep() {
System.out.println("Male sleep..");
}
}
class Female extends Human {
@Override
public void sleep() {
System.out.println("Female sleep..");
}
}
×¢ÒâÕâÀïµÄÏòÉÏתÐÍ£º
        Animal b=new Bird(); //ÏòÉÏתÐÍ
        b.eat();
´Ë´¦½«µ÷ÓÃ×ÓÀàµÄeat()·½·¨¡£Ô­Òò£ºbʵ¼ÊÖ¸ÏòµÄÊÇBird×ÓÀ࣬¹Êµ÷ÓÃʱ»áµ÷ÓÃ×ÓÀà±¾ÉíµÄ·½·¨¡£
ÐèҪעÒâµÄÊÇÏòÉÏתÐÍʱb»áÒÅʧ³ýÓ븸Àà¶ÔÏó¹²ÓеÄÆäËû·½·¨¡£Èç±¾ÀýÖеÄfly·½·¨²»ÔÙΪbËùÓС£
2£¬ÏòÉÏתÐ͵ĺô¦¡£
¿´ÉÏÃæµÄ´úÂ룬
    public static void dosleep(Human h) {
        h.sleep();
    }
ÕâÀïÒÔ¸¸ÀàΪ²ÎÊý£¬µ÷ÓÐʱÓÃ×ÓÀà×÷Ϊ²ÎÊý£¬¾ÍÊÇÀûÓÃÁËÏòÉÏתÐÍ¡£ÕâÑùʹ´úÂë±äµÃ¼ò½à¡£²»È»µÄ»°£¬Èç¹ûdosleepÒÔ×ÓÀà¶ÔÏóΪ²ÎÊý£¬ÔòÓжàÉÙ¸ö×ÓÀà¾ÍÐèҪд¶àÉÙ¸öº¯Êý¡£ÕâÒ²ÌåÏÖÁËJAVAµÄ³éÏó±à³Ì˼Ïë¡£
¶þ¡¢ÏòÏÂתÐÍ¡£
ÓëÏòÉÏתÐÍÏà·´£¬¼´ÊǰѸ¸Àà¶ÔÏóתΪ×ÓÀà¶ÔÏó¡£
¿´ÏÂÃæ´úÂ룺
package com.wensefu.other1;
public class Girl {
public void smile(){
System.out.println("girl smile()...");
}
}
class M


Ïà¹ØÎĵµ£º

java Êý×ÖÖ¤ÊékeytoolÓ÷¨

Java ÖÐµÄ keytool.exe £¨Î»ÓÚ JDK\Bin Ŀ¼Ï£©¿ÉÒÔÓÃÀ´´´½¨Êý×ÖÖ¤Ê飬ËùÓеÄÊý×ÖÖ¤ÊéÊÇÒÔÒ»ÌõÒ»Ìõ(²ÉÓñðÃûÇø±ð)µÄÐÎʽ´æÈëÖ¤Êé¿âµÄÖУ¬Ö¤Êé¿âÖеÄÒ»ÌõÖ¤Êé°üº¬¸ÃÌõÖ¤ÊéµÄ˽Կ£¬¹«Ô¿ºÍ¶ÔÓ¦µÄÊý×ÖÖ¤ÊéµÄÐÅÏ¢¡£Ö¤Êé¿âÖеÄÒ»ÌõÖ¤Êé¿ÉÒÔµ¼³öÊý×ÖÖ¤ÊéÎļþ£¬Êý×ÖÖ¤ÊéÎļþÖ»°üÀ¨Ö÷ÌåÐÅÏ¢ºÍ¶ÔÓ¦µÄ¹«Ô¿¡£
KeytoolÊÇÒ»¸öJavaÊý¾ÝÖ ......

JavaÄÚ´æÒç³ö

´ÓÎïÀíÉϽ²£¬¶ÑÕ»¾ÍÊÇÒ»¶ÎÁ¬Ðø·ÖÅäµÄÄÚ´æ¿Õ¼ä¡£ÔÚÒ»¸ö³ÌÐòÖУ¬»áÉùÃ÷¸÷ÖÖ±äÁ¿¡£¾²Ì¬È«¾Ö±äÁ¿ÊÇλÓÚÊý¾Ý¶Î²¢ÇÒÔÚ³ÌÐò¿ªÊ¼µÄʱºò¾Í±»¼ÓÔØ¡£¶ø³ÌÐòµÄ¶¯Ì¬µÄ¾Ö²¿±äÁ¿Ôò·ÖÅäÔÚ¶ÑÕ»ÀïÃæ¡£
JVM¹ÜÀíÁ½ÖÖÀàÐ͵ÄÄڴ棬¶ÑºÍ·Ç¶Ñ¡£¶ÑÊǸø¿ª·¢ÈËÔ±ÓõÄÉÏÃæ˵µÄ¾ÍÊÇ£¬ÊÇÔÚJVMÆô¶¯Ê±´´½¨£»·Ç¶ÑÊÇÁô¸øJVM×Ô¼ºÓõģ¬ÓÃÀ´´æ·ÅÀàµÄÐÅÏ¢µÄ¡£Ëüº ......

Mozilla½«Õë¶Ô¶ñÒâJava²å¼þ½øÐÐÆÁ±Î

 ¡¡¡¡¾Ý¹úÍâýÌ屨µÀ£¬MozillaÒѾ­Õë¶ÔFirefoxÉèÖÃÁËÒ»¸ö¶ñÒâJava²å¼þÆÁ±ÎºÚÃûµ¥¡£
¡¡¡¡¾Ý°²È«²©¿ÍBrian Krebs½éÉÜ£¬ÉÏÖܼ׹ÇÎĹ«Ë¾·¢²¼ÁËÒ»¸öÐÞ¸´Java²å¼þ©¶´µÄ¸üУ¬µ«ÊÇMozilla¿ª·¢ÈËÔ±·¢ÏÖ£¬Õâ¸ö¸üÐÂûÓÐɾ³ý¾É°æ±¾µÄ´úÂ룬ʹµÃϵͳÈÔÈ»ÁôÏÂÁË©¶´´úÂ룬´Ó¶øʹµÃÒÅÁô´úÂë³ÉΪеĩ¶´¡£¶Ô´Ë£¬Mozilla²»µÃ²»½«ÆÁ± ......

JavaÈ¡µÃ´úÂëËùÔÚÐкŵķ½·¨

ÓÃCµÄÈËÒ»¶¨ÖªµÀ__FILE__ºÍ__LINE__,µ«ÊÇJavaÖÐ ²¢Ã»ÓÐÕâÑùµÄ¶¨Ò壬ÓÐʱºòµ÷ÊÔ¶àÏ߳̾ͺܲ»·½±ã£¬Ã»°ì·¨£¬×Ô¼º¶¯ÊÖ£¬·áÒÂ×ãʳ~ÓÃÏÂÃæµÄº¯ÊýÈ¡µÃµ±Ç°Ðкš£
º¯Êý£º
/**
*µÃµ½ExceptionËùÔÚ´úÂëµÄÐÐÊý
*Èç¹ûûÓÐÐÐÐÅÏ¢,·µ»Ø-1
*/
public static int getLineNumber(Exception e){
StackTraceElement[] trace =e.getStac ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ