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

JavaỊ̈߳ºÐÂÌØÕ÷ Óзµ»ØÖµµÄÏß³Ì

JavaỊ̈߳ºÐÂÌØÕ÷-Óзµ»ØÖµµÄÏß³Ì
 
ÔÚJava5֮ǰ£¬Ïß³ÌÊÇûÓзµ»ØÖµµÄ£¬³£³£ÎªÁË“ÓД·µ»ØÖµ£¬ÆÆ·ÑÖÜÕÛ£¬¶øÇÒ´úÂëºÜ²»ºÃд¡£»òÕ߸ɴàÈƹýÕâµÀ¿²£¬×ß±ðµÄ·ÁË¡£
 
ÏÖÔÚJavaÖÕÓÚÓпɷµ»ØÖµµÄÈÎÎñ£¨Ò²¿ÉÒÔ½Ð×öỊ̈߳©ÁË¡£
 
¿É·µ»ØÖµµÄÈÎÎñ±ØÐëʵÏÖCallable½Ó¿Ú£¬ÀàËƵģ¬ÎÞ·µ»ØÖµµÄÈÎÎñ±ØÐëRunnable½Ó¿Ú¡£
 
Ö´ÐÐCallableÈÎÎñºó£¬¿ÉÒÔ»ñÈ¡Ò»¸öFutureµÄ¶ÔÏó£¬ÔڸöÔÏóÉϵ÷ÓÃget¾Í¿ÉÒÔ»ñÈ¡µ½CallableÈÎÎñ·µ»ØµÄObjectÁË¡£
 
ÏÂÃæÊǸöºÜ¼òµ¥µÄÀý×Ó£º
 
import java.util.concurrent.*;
/**
* JavaỊ̈߳ºÓзµ»ØÖµµÄÏß³Ì
*
* @author Administrator 2009-11-5 0:41:50
*/
public class Test {
        public static void main(String[] args) throws ExecutionException, InterruptedException {
                //´´½¨Ò»¸öÏ̳߳Ø
                ExecutorService pool = Executors.newFixedThreadPool(2);
                //´´½¨Á½¸öÓзµ»ØÖµµÄÈÎÎñ
                Callable c1 = new MyCallable("A");
                Callable c2 = new MyCallable("B");
                //Ö´ÐÐÈÎÎñ²¢»ñÈ¡Future¶ÔÏó
                Future f1 = pool.submit(c1);
                Future f2 = pool.submit(c2);
                //´ÓFuture¶ÔÏóÉÏ»ñÈ¡ÈÎÎñµÄ·µ»ØÖµ£¬²¢Êä³öµ½¿ØÖÆ̨
           &


Ïà¹ØÎĵµ£º

ʹÓÃeclipseÔËÐÐÔø¾­Ð´¹ýµÄjava´úÂë

½ñÌì°ÑÒÔǰдµÄjava´úÂëÄóöÀ´£¬·¢ÏÖ³öÁ˺öà´íÎó¡£µ÷ÁË°ëÌ죬·¢ÏÖÊÇ°æ±¾µÄÎÊÌ⣬ÓôÃÆ£¡
¿ÉÄÜ֮ǰÎÒд´úÂëµÄʱºòÓõÄÊÇJDK1.5£¬½ñÌì´ÓÍøÉÏÏÂÔØJDK1.6£¬Ã»³É¹¦¡£¾Í²Ý²ÝÏÂÔØÁËJDK1.5,½á¹û×ÜÊÇÌáʾ“could not find the main class. program will exit”¡£ÎҾ͵½
window-¡·preference-¡·java-¡·compiler°Ñµ±Ç°µÄ°æ ......

javaÖÐ== ÓëequalsµÄÇø±ð

public class test1
{
 public static void main(String[] args){
  //== ÓëequalsµÄÇø±ð
  //1.nullµÄ±È½Ï£ºÖ»ÄÜÓÃ==
  System.out.println("1.nullµÄ±È½Ï£ºÖ»ÄÜÓÃ==");
  Object o1=null,o2=null;
  System.out.println(null==null&&o1==null& ......

JavaỊ̈߳ºÏß³ÌջģÐÍÓëÏ̵߳ıäÁ¿

JavaỊ̈߳ºÏß³ÌջģÐÍÓëÏ̵߳ıäÁ¿
 
SCJP5ѧϰ±Ê¼Ç
 
ÒªÀí½âÏ̵߳÷¶ÈµÄÔ­Àí£¬ÒÔ¼°Ïß³ÌÖ´Ðйý³Ì£¬±ØÐëÀí½âÏß³ÌջģÐÍ¡£
Ïß³ÌÕ»ÊÇָijʱ¿ÌʱÄÚ´æÖÐÏ̵߳÷¶ÈµÄÕ»ÐÅÏ¢£¬µ±Ç°µ÷Óõķ½·¨×ÜÊÇλÓÚÕ»¶¥¡£Ïß³ÌÕ»µÄÄÚÈÝÊÇËæ×ųÌÐòµÄÔËÐж¯Ì¬±ä»¯µÄ£¬Òò´ËÑо¿Ïß³ÌÕ»±ØÐëÑ¡ÔñÒ»¸öÔËÐеÄʱ¿Ì£¨Êµ¼ÊÉÏÖ¸´úÂëÔËÐе½Ê²Ã´µØ· ......

JavaỊ̈߳ºÏß³Ì״̬µÄת»»

JavaỊ̈߳ºÏß³Ì״̬µÄת»»
 
SCJP5ѧϰ±Ê¼Ç
 
Ò»¡¢Ïß³Ì״̬
 
Ï̵߳Ä״̬ת»»ÊÇÏ߳̿ØÖƵĻù´¡¡£Ïß³Ì״̬×ܵĿɷÖΪÎå´ó״̬£º·Ö±ðÊÇÉú¡¢ËÀ¡¢¿ÉÔËÐС¢ÔËÐС¢µÈ´ý/×èÈû¡£ÓÃÒ»¸öͼÀ´ÃèÊöÈçÏ£º
 
1¡¢ÐÂ״̬£ºÏ̶߳ÔÏóÒѾ­´´½¨£¬»¹Ã»ÓÐÔÚÆäÉϵ÷ÓÃstart()·½·¨¡£
 
2¡¢¿ÉÔËÐÐ״̬£ºµ±Ïß³ÌÓÐ× ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ