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

javaÏß³Ì

1.Ï̴߳´½¨µÄÁ½ÖÖ·½Ê½
1£©À©Õ¹ThreadÀಢÖØдpublic void run()·½·¨
ps£º
¶¨ÒåỊ̈߳º
class myThread extends Thread(){
         public void run(){
                System.out.println("Just working !");
     }
}
ʵÀý»¯£º
myThread t=new myThread();
Æô¶¯£º
t.start();
2£©µ÷ÓôøRunnable±äÔªµÄThread¹¹Ô캯Êý
ps:
¶¨ÒåỊ̈߳º
class myRunnable implements Runnable{
        public void run(){
                System.out.println("Just working !");
     }
}
ʵÀý»¯£º
myRunnable r=new myRunnable();
Thread t=new Thread(r);
Æô¶¯£º
t.start();
2.ThreadÀà³£Ó÷½·¨
1£©ThreadÀàÖг£ÓÃÖØÔع¹Ô캯Êý£º
Thread()
Thread(Runnable target)
Thread(Runnable target,String name)
Thread(String name)
2£©setName() ÉèÖÃÏß³ÌÃû³Æ
getName()  »ñµÃÏß³ÌÃû³Æ
sleep() ±£Ö¤µ±Ç°Ïß³ÌÖÁÉÙÔÚÖ¸¶¨µÄ˯Ãßʱ¼äÍ£Ö¹Ö´ÐÐ
yield()  ʹµ±Ç°ÔËÐÐÖеÄÏ̻߳ص½¿ÉÔËÐÐ״̬£¬²¢Ê¹ÏàͬÓÅÏȼ¶µÄÏß³ÌÓлú»áÔËÐУ¬µ«²»±£Ö¤
join()   ±£Ö¤µ±Ç°Ïß³ÌÍ£Ö¹Ö´ÐУ¬Ö±µ½ËûËù¼ÓÈëµÄÏß³ÌÍê³ÉΪֹ
3£©Ö÷ÒªÏ̷߳½·¨
ObjectÀà          ThreadÀà          Runnable½Ó¿Ú
wait()              start()               run()
notify()            yield()  (¾²Ì¬)       
notifyAll()         sleep()(¾²Ì¬)   
                       jion()
3.Ïß³Ì״̬Óëת±ä
ÐÂ״̬-->¿ÉÔËÐÐ״̬<-->Ô


Ïà¹ØÎĵµ£º

Javaѧϰ±Ê¼Ç¢Ü

 Ñ§Ï°Java³ÌÐòÖ÷Òª°üº¬ÒÔÏÂËĸö²¿·Ö¡£
(1)±à¼­´úÂë  edit code
(2)±£´æ´úÂë  save code
(3)±àÒë´úÂë  compiler code
(4)ÔËÐгÌÐò  run program
µÚÒ»¸ö³ÌÐòÎļþHelloWorld.java
public class HelloWorld {
   public static void main(String[] args){
     ......

JavaÖÐÇó100µÄ½×³Ë

 Ê¹ÓÃBigInteger´óÈÝÁ¿ÔËËãÀà¼ÆËã100µÄ½×³Ë
Ò».Ò»°ãËã·¨(Ñ­»·)
public class Test {
public static void main(String[] args) {
int result = 1;
for (int i = 1; i <= 100; i++) {
result *= i;
}
System.out.println(result);
}
}
Êä³ö½á¹ûΪ0£¬ÒòΪintÎÞ·¨±£´æÏÂ100µÄ½×³ËµÄ½á¹û£¬100µ ......

Java¹Ø¼ü×Öfinal¡¢staticʹÓÃ×ܽ᡾ת¡¿

 Ò»¡¢final
        ¸ù¾Ý³ÌÐòÉÏÏÂÎÄ»·¾³£¬Java¹Ø¼ü×ÖfinalÓГÕâÊÇÎÞ·¨¸Ä±äµÄ”»òÕß“ÖÕ̬µÄ”º¬Ò壬Ëü¿ÉÒÔÐÞÊηdzéÏóÀà¡¢·Ç³éÏóÀà³ÉÔ±·½·¨ºÍ±äÁ¿¡£Äã¿ÉÄܳöÓÚÁ½ÖÖÀí½â¶øÐèÒª×èÖ¹¸Ä±ä£ºÉè¼Æ»òЧÂÊ¡£
        finalÀ಻Äܱ»¼Ì³Ð£ ......

JAVA¿ª·¢Õß×ȥµÄ20¸öÓ¢ÎÄÍøÕ¾

 
JAVA¿ª·¢Õß×ȥµÄ20¸öÓ¢ÎÄÍøÕ¾
1.[http://www.javaalmanac.com] – Java¿ª·¢ÕßÄê¼øÒ»ÊéµÄÔÚÏß°æ±¾. ÒªÏë¿ìËٲ鵽ijÖÖJava¼¼ÇɵÄÓ÷¨¼°Ê¾Àý´úÂë, ÕâÊÇÒ»¸ö²»´íµÄÈ¥´¦.
2.[http://www.onjava.com] – O’ReillyµÄJavaÍøÕ¾. ÿÖܶ¼ÓÐÐÂÎÄÕÂ.
3.[http://java.sun.com] – ¹Ù·½µÄJava¿ª·¢ÕßÍøÕ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ