JavaÖмÆʱÆ÷µÄʹÓÃ
import java.util.Timer;
import java.util.TimerTask;
public class TimerExample
{
/**
* JavaÖмÆʱÆ÷µÄʹÓÃ
* Time: 21:19 2010-1-5
*/
Timer localTimer;
public TimerExample(int seconds)
{
// Create local timer
localTimer = new Timer();
// Create local timer task and set the timer-parameter
localTimer.schedule(new LocalTimerTask(), 0, seconds * 1000);
}
class LocalTimerTask extends TimerTask
{
int bitTest = 0xFFFFFFFF;
int flag = 1;
int temp = bitTest;
// Override the abstract method of TimerTask
// The run() will be called every per timer
public void run()
{
if (temp < 0)
{
System.out.println(Integer.toBinaryString(temp));
temp = bitTest & (~flag);
flag <<= 1;
}
Ïà¹ØÎĵµ£º
1¡¢ÈçºÎ½«×Ö·û´®Stringת»¯ÎªÕûÊýint
int i = Integer.parseInt(str);
int i = Integer.valueOf(my_str).intValue();
×¢: ×Ö´®×ª³ÉDouble, Float, LongµÄ·½·¨´óͬСÒì¡£
2¡¢ÈçºÎ½«×Ö·û´®Stringת»¯ÎªInteger
Integer integer=Integer.valueOf(i)
3¡¢ÈçºÎ½«ÕûÊý ......
1.
superÊǵ÷Óø¸ÀàµÄ¹¹Ô캯Êý
2.
thisµ÷ÓõÄͬÀàµÄ¹¹Ô캯Êý.
3.
3.1
synchronized¹Ø¼ü×ÖµÄ×÷ÓÃÓòÓжþÖÖ
3.1.1
ÊÇij¸ö¶ÔÏóʵÀýÄÚ£¬synchronized aMethod(){}¿ÉÒÔ·ÀÖ¹¶à¸öÏß³Ìͬʱ·ÃÎÊÕâ¸ö¶ÔÏóµÄsynchronized·½·¨£¨Èç¹ûÒ»¸ö¶ÔÏóÓжà¸ösynchronized·½·¨£¬Ö»ÒªÒ»¸öÏ̷߳ÃÎÊÁËÆäÖеÄÒ»¸ösynchronized·½·¨£¬ÆäËüÏ̲߳»ÄÜ ......
ת×Ô
http://www.blogjava.net/hongzionline/archive/2007/09/19/146392.html
final ¹Ø¼ü×Ö ºÍ static Ó÷¨
Ò»¡¢final
¸ù¾Ý³ÌÐòÉÏÏÂÎÄ»·¾³£¬Java¹Ø¼ü×ÖfinalÓГÕâÊÇÎÞ·¨¸Ä±äµÄ”»òÕß“ÖÕ̬µÄ”º¬Ò壬Ëü¿ÉÒÔÐÞÊηdzéÏóÀà¡¢·Ç³éÏóÀà³ÉÔ±·½·¨ºÍ±äÁ¿¡£Äã¿ÉÄܳöÓÚÁ½ÖÖÀí½â¶øÐèÒª×èÖ¹¸Ä±ä£ºÉè¼Æ»òЧÂÊ¡ ......
Ò»¡¢static
¡¡¡¡ÇëÏÈ¿´ÏÂÃæÕâ¶Î³ÌÐò£º
public class Hello{
public static void main(String[] args){ //(1)
System.out.println("Hello,world!"); //(2)
}
}
¡¡¡¡¿´¹ýÕâ¶Î³ÌÐò£¬¶ÔÓÚ´ó¶àÊýѧ¹ýJava
µÄ´ÓÀ´Ëµ£¬¶¼²»Ä°Éú¡£¼´Ê¹Ã»ÓÐѧ¹ýJava£¬¶øѧ¹ýÆäËüµÄ¸ß¼¶ÓïÑÔ£¬ÀýÈçC£¬ÄÇÄãÒ²Ó¦¸ÃÄÜ¿´¶®Õâ¶Î´úÂëµÄÒâË ......