dz̸Java¶àÏ̵߳Äͬ²½ÎÊÌâ
¶àÏ̵߳Äͬ²½ÒÀ¿¿µÄÊǶÔÏóËø»úÖÆ£¬synchronized¹Ø¼ü×ֵı³ºó¾ÍÊÇÀûÓÃÁË·âËøÀ´ÊµÏÖ¶Ô¹²Ïí×ÊÔ´µÄ»¥³â·ÃÎÊ¡£
ÏÂÃæÒÔÒ»¸ö¼òµ¥µÄʵÀýÀ´½øÐжԱȷÖÎö¡£ÊµÀýÒªÍê³ÉµÄ¹¤×÷·Ç³£¼òµ¥£¬¾ÍÊÇ´´½¨10¸öỊ̈߳¬Ã¿¸öÏ̶߳¼´òÓ¡´Ó0µ½99Õâ100¸öÊý×Ö£¬ÎÒÃÇÏ£ÍûÏß³ÌÖ®¼ä²»»á³öÏÖ½»²æÂÒÐò´òÓ¡£¬¶øÊÇ˳ÐòµØ´òÓ¡¡£
ÏÈÀ´¿´µÚÒ»¶Î´úÂ룬ÕâÀïÎÒÃÇÔÚrun()·½·¨ÖмÓÈëÁËsynchronized¹Ø¼ü×Ö£¬Ï£ÍûÄܶÔrun·½·¨½øÐл¥³â·ÃÎÊ£¬µ«½á¹û²¢²»ÈçÎÒÃÇÏ£ÍûÄÇÑù£¬ÕâÊÇÒòΪÕâÀïsynchronizedËø×¡µÄÊÇthis¶ÔÏ󣬼´µ±Ç°ÔËÐÐÏ̶߳ÔÏó±¾Éí¡£´úÂëÖд´½¨ÁË10¸öỊ̈߳¬¶øÃ¿¸öÏ̶߳¼³ÖÓÐthis¶ÔÏóµÄ¶ÔÏóËø£¬Õâ²»ÄÜʵÏÖÏ̵߳Äͬ²½¡£´úÂëpackage com.vista;
class MyThread implements java.lang.Runnable
{
private int threadId;
public MyThread(int id)
{
this.threadId = id;
}
@Override
public synchronized void run()
{
for (int i = 0; i < 100; ++i)
{
System.out.println("Thread ID: " + this.threadId + " : " + i);
}
}
}
public class ThreadDemo
{
/**
* @param args
* @throws InterruptedException
*/
public static void main(String[] args) throws InterruptedException
{
for (int i = 0; i < 10; ++i)
&nbs
Ïà¹ØÎĵµ£º
ÎÒ²»ÖªµÀÕâÆªÎÄÕµÄ×÷ÕßÊÇË£¬µ«ÎÒÖªµÀ£¬Ëû¶ÔjavaÓÐÒ»ÖÖºÜÉîµÄÀí½â£¬ÆäʵÎÄÕÂÖв¢Ã»ÓÐÌåÏÖ³ö×÷Õß¶Ôjava¼¼ÊõÉî²ãÀí½â£¬µ«ÊÇ´ÓÎÄÖеÄÿһ¾ä»°ÖУ¬ÎÒ¸ÐÊܵ½ÁËһЩ¶«Î÷¡£ÕâÊÇһƪºÜºÃµÄÎÄÕ£¬Ò²¿ÉÒÔ°ïÖúºÜ¶àÈËÃÔãµÄÈ˽â¾öÎÊÌâ¡£´øÀ´ºÍ´ó¼Ò·ÖÏíһϡ£
ǰ²»¾ÃCSDN¿¯µÇÁËһƪ¡¶CÓïÑÔÒѾËÀÁË¡·µÄÎÄÕ£¬ÒýÆðÁËһЩÕùÂÛ¡£ÆäʵÄÇÆ ......
ÔÚ²âÊÔ
ConsoleRunner
µÄ¹ý³ÌÖз¢ÏÖÒ»¸öÓÐÒâ˼µÄÏÖÏó£¬Ò»¶ÎºÜ¼òµ¥µÄ
C
³ÌÐò£º
#include <stdio.h>
#include <windows.h>
int main() {
int i = 0;
for (;;) {
printf("%d\n", i++); ......
¿ìÅÅ£º¿ìËÙÅÅÐò£¬ÄѶȲ»ÊÇÌ«´ó£¬µ«ÊÇÊÇÎÒ¾³£°ÑÍæµÄС´úÂëÖ®Ò»£¬ÒýÓÿìÅÅ´úÂ봴ʼÈ˵ÄÒ»¾ä»°“Òª²»ÊǼòÁ·ÓÖÃ÷ÏÔûÓдíÎó£¬Òª²»ÊǸ´ÔÓûÓÐÃ÷ÏԵĴíÎó”
ÆðÒò£º
Ö÷ÒªÊÇǰһÕó¿´ÁõÈê¼ÑµÄ¡¶Ëã·¨ÒÕÊõÓëÐÅϢѧ¾ºÈü¡·P73Ò³£¬ÅöÇÉÎÒÓÖÇ×ÊÖдÁËÒ»±éÄÇÊéÉϵIJâÊÔÁËһϣ¬·¢ÏÖ¾¹È»ÊÇ´íÎóµÄ£¬È»ºóÎÒÓÖ²âÊÔÁËÒ»ÏÂÎÒÒÔÇ ......
JavaʼþÄ£ÐÍÓëAndroidʼþÄ£Ð͵ıȽÏ
±È½Ï½á¹û£ºAndroid½è¼øÁËJava2ÖеÄUIʼþ´¦Àí»úÖÆ£¬µ«ÊÇ£¬AndroidÓÖÌṩÁËÁíÒ»ÖÖʼþ處ÀíÆ÷£¨event handler£©£¬¶øÕâ¸ö·½Ê½ÊÇ·ñÓëjava1.0ʼþÄ£ÐÍÒ»ÑùÄØ£¬ÓдýÇóÖ¤¡£
JavaʼþÄ£ÐÍ£º
ÎÒÃǰÑJDK1.0ʼþ´¦ÀíÄ£ÐͳÉΪJava1.0ʼþÄ£ÐÍ£¬¶ø´Ójdk1.1ºóµÄ°æ±¾Ê¼þ´¦ÀíÄ£ÐͳÆÎªJava 2Ê ......
¸ÕѧGIS£¬×ö¸öÉèÖõØÍ¼Öеã¾Í³öÁËÂé·³ £¡µ«ÊÇÒ»Ö±¾ÍÊÇÉèÖò»ÕýÈ·£¬¸ãÁËN¾Ã£»ºóÀ´·¢ÏÖÎÊÌâÔÚÓÚÉèÖõĵØÍ¼±ß½ç¸ß¶È¼°¿í¶ÈÒªÓëÒ³Ãæ¶ÔÓ¦µÄÊä³ö´¦µÄ¸ß¶È¼°¿í¶ÈÒªÒ»Ö¡£
Ò²¾ÍÊÇ£º
myMap.setDeviceBounds(new DoubleRect(0, 0, m_mapWidth, m_mapHeight));
m_mapWidth, m_mapHeight µÄÖµÒªÓëÏÂà ......