JavaµÄ´úÀíģʽÀý×Ó
(1). ´´½¨Ò»¸ö½Ó¿Ú, Òª´úÀíµÄÀàºÍ ´úÀíÀ඼½«¼Ì³ÐËü
package stone;
public interface Image {
public void show();
}
(2). ´´½¨Òª±»´úÀíµÄÀà:
package stone;
public class BigImage implements Image {
public BigImage() {
try {
Thread.sleep(3000); // Ä£Äâ´óͼƬҪÓó¤Ê±¼äÀ´¼ÓÔØ
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.println("loading big image ");
}
public void show() {
System.out.println("show image");
}
}
(3). ´´½¨´úÀíÀà
package stone;
public class TestProxy {
public static void main(String[] args) {
long start= System.currentTimeMillis();
Image image= new ImageProxy(null);
System.out.println("Load time:"+String.valueOf(System.currentTimeMillis()-start));
image.show();
System.out.println("Show time:"+String.valueOf(System.currentTimeMillis()-start));
}
}
(4). ÔËÐвâÊÔÀà,²âÊÔ´úÀíģʽ:
package stone;
public class TestProxy {
public static void main(String[] args) {
long start= System.currentTimeMillis();
Image image= new ImageProxy(null);
System.out.println("Load time:"+String.valueOf(Syste
Ïà¹ØÎĵµ£º
ÎÊÌâµÄÒýÈëÊÇÒòΪÏÂÎçÔÚȺÀï¿´µ½ÁËÒ»¸öÍøÓѵÄÎÊÌ⣺
¸ø¶¨ÈçÏÂJava ´úÂ룬±àÒëÔËÐкó£¬Êä³ö½á¹ûÊÇ£¨ £©¡£
public class Test {
public static void main(String [ ] args) {
StringBuffer a = new StringBuffer(“A”);
&n ......
1.2.1 javaÐéÄâ»ú(1)
¡¡javaÐéÄâ»úÊÇÈí¼þÄ£ÄâµÄ¼ÆËã»ú£¬¿ÉÒÔÔÚÈκδ¦ÀíÆ÷ÉÏ£¨ÎÞÂÛÊÇÔÚ¼ÆËã»úÖл¹ÊÇÔÚÆäËüµç×ÓÉ豸ÖУ©°²È«²¢ÇÒ¼æÈݵÄÖ´Ðб£´æÔÚ.classÎļþÖеÄ×Ö½ÚÂë¡£javaÐéÄâ»úµÄ"»úÆ÷Âë"±£´æÔÚ.classÎļþÖУ¬ÓÐʱҲ¿ÉÒÔ³Æ֮Ϊ×Ö½ÚÂëÎļþ¡£java³ÌÐòµÄ¿çƽ̨Ö÷ÒªÊÇÖ¸×Ö½ÚÂëÎļþ¿ÉÒÔÔÚÈκξßÓÐjavaÐéÄâ»úµÄ¼ÆËã»ú»òÕßµç×ÓÉ ......
javaÐéÄâ»ú
¡¡¡¡µ«ÊÇ£¬javaÐéÄâ»úµÄ½¨Á¢ÐèÒªÕë¶Ô²»Í¬µÄÈíÓ²¼þƽ̨×öרÃŵÄʵÏÖ£¬¼ÈÒª¿¼ÂÇ´¦ÀíÆ÷µÄÐͺţ¬Ò²Òª¿¼ÂDzÙ×÷ϵͳµÄÖÖÀà¡£ÈçÏÂͼËùʾ£¬Ä¿Ç°ÔÚSPARC½á¹¹¡¢X86½á¹¹¡¢MIPSºÍPPCµÈǶÈëʽ´¦ÀíоƬÉÏ¡¢ÔÚUNIX¡¢Linux¡¢windowsºÍ²¿·Öʵʱ²Ù×÷ϵͳÉ϶¼ÓÐjavaÐéÄâ»úµÄʵÏÖ¡£ ......
¡¡1£® ¼òµ¥¡¢ÃæÏò¶ÔÏóºÍΪÈËËùÊìϤ
¡¡¡¡javaµÄ¼òµ¥Ê×ÏÈÌåÏÖÔÚ¾«¼òµÄϵͳÉÏ£¬Á¦Í¼ÓÃ×îСµÄϵͳʵÏÖ×ã¹»¶àµÄ¹¦ÄÜ£»¶ÔÓ²¼þµÄÒªÇ󲻸ߣ¬ÔÚСÐ͵ļÆËã»úÉϱã¿ÉÒÔÁ¼ºÃµÄÔËÐС£ºÍËùÓеÄÐÂÒ»´úµÄ³ÌÐòÉè¼ÆÓïÑÔÒ»Ñù£¬javaÒ²²ÉÓÃÁËÃæÏò¶ÔÏó¼¼Êõ²¢¸ü¼Ó³¹µ×£¬ËùÓеÄjava³ÌÐòºÍapplet³ÌÐò¾ùÊǶÔÏ󣬷â×°ÐÔʵÏÖÁËÄ£¿é»¯ºÍÐÅÏ¢Òþ²Ø£¬¼Ì³ÐÐÔ ......