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ÓïÑÔÖÐÓÐÎåÖÖ²»Í¬ÀàÐ͵ij£Á¿,
–
•1ÕûÐͳ£Á¿:ÈκÎÒ»¸öÕûÐÍÊý×Ö¾ÍÊÇÒ»¸öÕûÐͳ£Á¿.
–JavaÓïÑÔÖÐ,ÕûÐͳ£Á¿ÓÐÈýÖÖ±íʾ·½Ê½:
•Ê®½øÖÆ:0,1,2,3,4,5,6,7,8,9,10,11,12…¶¼ÊÇÊ®½øÖƵij£Á¿
•°Ë½øÖÆ:°Ë½øÖÆ¿ÍÁ÷Á¿Ö»ÄÜÓÃ0,1,2,3,4,5,6,7À ......
×òÌì¿´µ½ÕâÑùһƪÌû×Ó£¬ÌÖÂÛÀà¼ÓÔØ˳ÐòµÄ£¬Ò²¿ÉÒÔ˵Êdzõʼ»¯Ë³ÐòµÄ£¬½ñÌìÔçÉÏÕÒ²»µ½ÁË£¬±¾À´Ïë»Ø¸´µÄ£¬ÏÖÔÚ×Ô¼ºÐ´²©¿Í»Ø¸´ÁË£¬ºÇºÇ
public class Singleton {
private static Singleton obj = new Singleton();
public static int counter1 ;
public static int counter2 = 0;& ......
annotations : ×¢ÊÍ
ºÃ´¦
1.Îĵµ±àÖÆ
2.±àÒëÆ÷¼ì²é
3.´úÂë·ÖÎö
JSR 175 ÊDZà³ÌÓïÑÔµÄÔªÊý¾Ý¹¤¾ß,Ϊ½«ÔªÊý¾ÝºÏ²¢µ½ºËÐÄjavaÓïÑÔÖÐÌṩÕýʽÀíÓɺÍ˵Ã÷
»ù±¾ÖªÊ¶:
×¢ÊͲÉÓÃ"@"±ê¼ÇÐÎʽ,ºóÃæÊÇ×¢ÊÍÃû³Æ,È»ºóÔÚÐèÒªÊý¾Ýʱ,ͨ¹ýname=value¶ÔÏò×¢ÊÍÌṩÊý¾Ý
×¢Ê͵ÄÈý¸ö»ù±¾ÖÖÀà:
±ê¼Ç×¢ÊÍ ......
ÔÚÏîÄ¿Öо³£»áÓöµ½Ê¹ÓÃCSVÎļþ£¬±ÈÈç´ÓHRÖеõ½µÄÎļþÄõ½ÆäËüµØ·½È¥´¦Àí£¬Êµ¼Ê»áÐèÒªµÃµ½µ±Ç°ºÍÉÏ´ÎÎļþÖеIJîÒ죬±ÈÈ磺Ìí¼Ó£¬É¾³ý£¬Ð޸ģ¬ ÄÇôÈçºÎÀ´ÊµÏÖÄØ£¬¿ÉÄÜÓкܵķ½·¨£¬ÔÚÕâÀïÎÒ˵һÏÂÎÒµÄʵÏÖ·½·¨¶øÇÒÒÑͶÈëʵ¼ÊʹÓá£
Ê×ÏÈ£¬ CSVÎļþµäÐÍÒÔ,·Ö¸ô£¬µ±È»»¹ÓÐÆäËüµÄ×Ö·û£¬ÓɺܶàÁеÄÊôÐÔºÍÊôÐÔÖµ×é³É£¬ÄÇôÁ½¸öÎ ......
System.out.println(2.00 -1.10);//0.8999999999999999
ÉÏÃæµÄ¼ÆËã³öµÄ½á¹û²»ÊÇ0.9£¬¶øÊÇÒ»Á¬´®µÄСÊý¡£ÎÊÌâÔÚÓÚ1.1 Õâ¸öÊý×Ö²»Äܱ»¾«È·±íʾ
Ϊһ¸ödouble£¬Òò´ËËü±»±íʾΪ×î½Ó½üËüµÄdouble Öµ£¬¸Ã³ÌÐò´Ó2 ÖмõÈ¥µÄ¾ÍÊÇÕâ¸öÖµ£¬
µ«Õâ¸ö¼ÆËãµÄ½á¹û²¢²»ÊÇ×î½Ó½ü0.9 µÄdoubleÖµ¡£
Ò»°ãµØ˵£¬ÎÊÌâÔÚÓÚ²¢²»ÊÇËùÓеÄСÊý¶¼¿ÉÒ ......