JavaÖÐʵÏÖ¶àÏß³Ì
ÎÒÃDz»·ÁÉèÏ룬ΪÁË´´½¨Ò»¸öеÄỊ̈߳¬ÎÒÃÇÐèÒª×öЩʲô£¿ºÜÏÔÈ»£¬ÎÒÃDZØÐëÖ¸Ã÷Õâ¸öÏß³ÌËùÒªÖ´ÐеĴúÂ룬¶øÕâ¾ÍÊÇÔÚJavaÖÐʵÏÖ¶àÏß³ÌÎÒÃÇËùÐèÒª×öµÄÒ»ÇУ¡
×÷Ϊһ¸öÍêÈ«ÃæÏò¶ÔÏóµÄÓïÑÔ£¬JavaÌṩÁËÀà java.lang.Thread À´·½±ã¶àÏ̱߳à³Ì£¬Õâ¸öÀàÌṩÁË´óÁ¿µÄ·½·¨À´·½±ãÎÒÃÇ¿ØÖÆ×Ô¼ºµÄ¸÷¸öÏ̡߳£
ÄÇôÈçºÎÌṩ¸ø Java ÎÒÃÇÒªÏß³ÌÖ´ÐеĴúÂëÄØ£¿ÈÃÎÒÃÇÀ´¿´Ò»¿´ Thread Àà¡£Thread Àà×îÖØÒªµÄ·½·¨ÊÇ run£¨£© £¬ËüΪThread ÀàµÄ·½·¨ start£¨£© Ëùµ÷Óã¬ÌṩÎÒÃǵÄÏß³ÌËùÒªÖ´ÐеĴúÂ롣ΪÁËÖ¸¶¨ÎÒÃÇ×Ô¼ºµÄ´úÂ룬ֻÐèÒª¸²¸ÇËü£¡
·½·¨Ò»£º¼Ì³Ð Thread À࣬ÖØд·½·¨ run£¨£©£¬ÎÒÃÇÔÚ´´½¨µÄ Thread ÀàµÄ×ÓÀàÖÐÖØд run£¨£© £¬¼ÓÈëÏß³ÌËùÒªÖ´ÐеĴúÂë¼´¿É¡£ÏÂÃæÊÇÒ»¸öÀý×Ó£º
public class TwoThread extends Thread {
public void run() {
for ( int i = 0; i < 10; i++ ) {
System.out.println("New thread");
}
}
public static void main(String[] args) {
TwoThread tt = new TwoThread();
tt.start();
for ( int i = 0; i < 10; i++ ) {
System.out.println("Main thread");
}
}
}
ÕâÖÖ·½·¨¼òµ¥Ã÷ÁË£¬·ûºÏ´ó¼ÒµÄÏ°¹ß£¬µ«ÊÇ£¬ËüÒ²ÓÐÒ»¸öºÜ´óµÄȱµã£¬ÄǾÍÊÇÈç¹ûÎÒÃǵÄÀàÒѾ´ÓÒ»¸öÀà¼Ì³Ð£¬ÔòÎÞ·¨Ôټ̳РThread Àà¡£
·½·¨¶þ£ºÊµÏÖ Runnable ½Ó¿Ú
Runnable ½Ó¿ÚÖ»ÓÐÒ»¸ö·½·¨ run£¨£©£¬ÎÒÃÇÉùÃ÷×Ô¼ºµÄÀàʵÏÖ Runnable ½Ó¿Ú²¢ÌṩÕâÒ»·½·¨£¬½«ÎÒÃǵÄÏ̴߳úÂëдÈëÆäÖУ¬¾ÍÍê³ÉÁËÕâÒ»²¿·ÖµÄÈÎÎñ¡£µ«ÊÇ Runnable ½Ó¿Ú²¢Ã»ÓÐÈκζÔÏ̵߳ÄÖ§³Ö£¬ÎÒÃÇ»¹±ØÐë´´½¨ Thread ÀàµÄʵÀý£¬ÕâÒ»µãͨ¹ý Thread ÀàµÄ¹¹Ô캯Êýpublic Thread£¨Runnable target£©£»À´ÊµÏÖ¡£ÏÂÃæÊÇÒ»¸öÀý×Ó£º
public class MyThread implements Ru
Ïà¹ØÎĵµ£º
½ñÌì¼ÌÐøѧϰjavaºÍandroidƽ̨ javaµÄѧϰËãÊDz¹³ä£¬ÒòΪûÓÐjava»ù´¡Ò²×ö²»³öʲô¶«Î÷À´
½ñÌì¿´µ½javaÓÃthis¹Ø¼ü×ÖÀ´ÖØÔع¹Ôì·½·¨£¬ÔÚÕâÀï×ö¸ö±Ê¼Çclass a_sample{
public int x,y.z;
a_sample(int x){
this.x=x;
}
a_sample(int x,int y){
this(x);
this.y=y;
}
a_sample(int x ......
×î½ü¹«Ë¾Òª¿ª·¢Windowsƽ̨ÉϵIJúÆ·£¨ÓÉÓÚÉæ¼°µ½ÉÌÒµ»úÃÜ£¬ËùÒÔÄ¿Ç°ÎÞ·¨¶ÔÕâ¸ö²úÆ·×öÏêϸ½éÉÜ£©£¬²ÉÓÃ.Net¼¼Êõ½øÐпª·¢£¬ÎÒ¸ºÔðµÄÊÇ»ùÓÚ Visual Studio²å¼þ»úÖƵÄÐÐÒµ¿ª·¢¹¤¾ßµÄ¿ª·¢¡£´Ó¿ªÊ¼½Ó´¥.Netµ½ÏÖÔÚÒѾÓнüÈý¸öÔÂÁË£¬¶øÇÒÒ²¿ª·¢³öÁ˵ÚÒ»¸ö°æ±¾£¬¶Ô.NetÒѾÓÐÁËһЩÈÏʶ£¬ÓÉÓÚÒÔÇ°Ö÷ÒªÓÃJava¡¢PythonµÈÓïÑ ......
½Å±¾±äÁ¿ÊÇʹÓà var »ò def ¹Ø¼ü×ÖÉùÃ÷µÄ¡£
¶þÕßÖ®¼äµÄÇø±ðÔÚÓÚ£ºÔڽű¾µÄÕû¸öÉúÃüÖÜÆÚÄÚ¶¼¿ÉÒÔΪ var ±äÁ¿¸³ÓèÐÂÖµ£¬
¶ø def ±äÁ¿ÔÚ±»Ê״θ³ÓèÐÂÖµºó½«±£³Ö²»±ä£»
def numOne = 100;
def numTwo = 2;
var result;
add();
subtract();
multiply();
divide();
function add() {
result = numOne + numTwo; ......
ÓÅÏȼ¶
ÔËËã·û
Ãû³Æ
1
( )
À¨ºÅ
2
[ ] , ¡£
ºó׺ÔËËã·û
3
- (Ò»ÔªÔËËã·û£¬È¡¸ºÊý) , ! , ~ , ++ , --
Ò»ÔªÔËËã·û
4
* , / , %
³Ë£¬³ý£¬È¡Ä£
5
+, -
¼Ó£¬¼õ
6
>> , << , >>>
ÒÆλÔËËã·û
7
> , < , >= , <= , instanceof
¹ØϵÔËËã·û
8
==,!=
µÈÓÚ£¬²»µÈÓÚ
9
......