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.Ïß³Ì״̬Óëת±ä
ÐÂ״̬-->¿ÉÔËÐÐ״̬<-->Ô
Ïà¹ØÎĵµ£º
ʹÓÃ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 ÊÇÒ»ÃÅÖ§³Ö¶àÏ̵߳ĵÄÓïÑÔ£¬µ«ÔÚ´¦Àí¶àÏß³ÌʼþʱÎÒÃDZØÐë×¢ÒâÕâÑùÒ»¸öÎÊÌ⣺¶à¸öÏ߳̿ÉÄÜͬʱ¶Ôͬһ¶ÔÏóµÄÐ޸ġ£Èç¹ûÎÒÃDz»¼°Ê±×÷³ö´¦Àí£¬¿ÉÄÜÒýÆð¶ÔÏóÖµµÄ»ìÂÒ¡£Æäʵ´¦Àí°ì·¨Ò²ºÜ¼òµ¥£¬¾ÍÊǵ±Ò»¸öÏ̴߳¦ÀíÒ»¸ö¶ÔÏó£¬Ëøס¸Ã¶ÔÏó¡£ ......
JAVA³£ÓÃÀàµÄʹÓ÷½·¨
£±¡¢IntegerÀà
£²¡¢FloatÀà
£³¡¢DoubleÀà
£´¡¢CharacterÀà
£µ¡¢StringÀà
£¶¡¢StringTokenizerÀà
£·¡¢StringBufferÀà
£¸¡¢RandomÀà
1£®IntegerÀàµÄʹÓ÷½·¨
Interger£ºÕûÊýÀàÐÍ
£±¡¢ÊôÐÔ¡£
static int MAX_VALUE£º·µ»Ø×î´óµÄÕûÐÍÊý£»
static int MIN_VALUE£º·µ»Ø×îСµÄÕûÐÍÊý£»
static C ......
JAVA¿ª·¢Õß×ȥµÄ20¸öÓ¢ÎÄÍøÕ¾
1.[http://www.javaalmanac.com] – Java¿ª·¢ÕßÄê¼øÒ»ÊéµÄÔÚÏß°æ±¾. ÒªÏë¿ìËٲ鵽ijÖÖJava¼¼ÇɵÄÓ÷¨¼°Ê¾Àý´úÂë, ÕâÊÇÒ»¸ö²»´íµÄÈ¥´¦.
2.[http://www.onjava.com] – O’ReillyµÄJavaÍøÕ¾. ÿÖܶ¼ÓÐÐÂÎÄÕÂ.
3.[http://java.sun.com] – ¹Ù·½µÄJava¿ª·¢ÕßÍøÕ ......
ArrayList ºÍVectorÊDzÉÓÃÊý×鷽ʽ´æ´¢Êý¾Ý£¬´ËÊý×éÔªËØÊý´óÓÚʵ¼Ê´æ´¢µÄÊý¾ÝÒÔ±ãÔö¼ÓºÍ²åÈëÔªËØ£¬¶¼ÔÊÐíÖ±½ÓÐòºÅË÷ÒýÔªËØ£¬µ«ÊDzåÈëÊý¾ÝÒªÉè¼Æµ½Êý×éÔªËØÒƶ¯µÈÄÚ´æ²Ù×÷£¬ËùÒÔË÷ÒýÊý¾Ý¿ì²åÈëÊý¾ÝÂý£¬VectorÓÉÓÚʹÓÃÁËsynchronized·½·¨£¨Ḭ̈߳²È«£©ËùÒÔÐÔÄÜÉϱÈArrayListÒª²î£¬LinkedListʹÓÃË«ÏòÁ´±íʵÏÖ´æ´¢£¬°´Ðòº ......