javaÏß³ÌѧϰÀý×Ó
public class TextDemo {
public static void main(String[] args) {
RunnableEemo r1 = new RunnableEemo();
r1.REemo(r1);
System.out.println(r1.print());
}
}
class RunnableEemo extends ThreadRun implements Runnable {
Thread t2 = null;
public void REemo(RunnableEemo r1) {
Thread t1 = new Thread(r1, "µÚÒ»Ïß³Ì ");
System.out.println("ÕýÔÚÔËÐеÄÊÇ" + t1);
t2 = new Thread(r1, "µÚ¶þÏß³Ì");
System.out.println("´´½¨µÚ¶þÏß³Ì");
System.out.println("µÚÒ»Ï߳̿ªÊ¼ÐÝÃß");
t2.start();
try {
t1.sleep(400);
} catch (InterruptedException e) {
System.out.println("µÚÒ»Ï̴߳íÎó ");
}
System.out.println("µÚÒ»Ïָ̻߳´ÔËÐÐ ");
}
public void run() {
try {
for (int i = 0; i < 800; i += 100) {
System.out.println("µÚ¶þÏ̵߳ÄÐÝÃßʱ¼ä£º " + i);
t2.sleep(i);
}
} catch (InterruptedException e) {
System.out.println("µÚ¶þÏ̴߳íÎó£¡");
}
}
}
class ThreadRun {
public String print() {
return "ÎÒÊÇRunnableDemoµÄ¸¸À࣡";
}
}
Ïà¹ØÎĵµ£º
JavaÖеÄ23ÖÖÉè¼Æģʽ
1¡¢¹¤³§Ä£Ê½£º¿Í»§ ......
ͨ¹ý·´Éä´´½¨ÐÂÀàʾÀýµÄÁ½ÖÖ·½Ê½¼°±È½Ï
×÷ÕßBLOG£ºhttp://blog.csdn.net/fenglibing
ͨ¹ý·´Éä´´½¨ÐµÄÀàʾÀý£¬ÓÐÁ½ÖÖ·½Ê½£º
Class.newInstance()
Constructor.newInstance()
ÒÔ϶ÔÁ½ÖÖµ÷Ó÷½Ê½¸øÒԱȽÏ˵Ã÷£º
l Class.newInstance() Ö»ÄÜ ......
JavaµÄ¶ÑÊÇÒ»¸öÔËÐÐʱÊý¾ÝÇø£¬ÀàµÄʵÀý(¶ÔÏó)´ÓÖзÖÅä¿Õ¼ä¡£JavaÐéÄâ»ú(JVM)
µÄ¶ÑÖд¢´æ×ÅÕýÔÚÔËÐеÄÓ¦ÓóÌÐòËù½¨Á¢µÄËùÓжÔÏó£¬ÕâЩ¶ÔÏóͨ¹ýnew¡¢newarray¡¢anewarrayºÍmultianewarrayµÈÖ¸Á
Á¢£¬µ«ÊÇËüÃDz»ÐèÒª³ÌÐò´úÂëÀ´ÏÔʽµØÊÍ·Å¡£Ò»°ãÀ´Ëµ£¬¶ÑµÄÊÇÓÉÀ¬»ø»ØÊÕ
À´¸ºÔðµÄ£¬¾¡¹ÜJVM¹æ·¶²¢²»ÒªÇóÌØÊâµÄÀ¬»ø»ØÊÕ¼¼Êõ£ ......
ÏîÄ¿ÐèÒª·ÖÎöÕû¸öϵͳµÄÉÏÏßÔËÐÐÐÔÄÜ,ËùÒÔÏÖÔÚÀëÉÏÏß»¹Ôç,µ«ÊDZØÐëÄ£Äâ²¢·¢ÏÖÒÔºó¿ÉÄܳöÏÖµÄÐÔÄÜÎÊÌâ.
Á½¸ö±È½ÏºÃµÄ¹¤¾ß:JProbe,yourkit java profile,¸Õ¿ªÊ¼×°ÁËJprobeµÄeclipse²å¼þ,ºóÀ´·¢ÏÖÕⶫÎ÷Ì«¸´ÔÓ,¶øÇÒ»¹±¨²»Ö§³Öjdk 1.6.û·¨·¢¿´µ½´ó¶àÊýÍøÓÑÑ¡Ôñyourkit,ËùÒÔÒ²ÏÂÁËÀ´,±Ï¾¹²»´ó,½á¹û·¢ÏÖËûÓкÜÍêÕûµÄÎĵµºÍflash ......