JAVA ¶ÔÏóºÍÀà
String s = new Date().toString();¿ÉÒÔÖ±½Ó´´½¨ÍêжÔÏóºó¾ÍÁ¢¼´ÓÃÆäµÄ·½·¨¡£
Ò»¸ö¶ÔÏó±äÁ¿²¢Ã»ÓÐʵ¼Ê°üº¬Ò»¸ö¶ÔÏ󣬶øÊǽö½öÒýÓÃÒ»¸ö¶ÔÏó¡£
GregorianCalendarÀà
javaÉè¼ÆÕß¾ö¶¨°Ñ±£´æʱ¼äÓë¸øʱ¼äµãÃüÃû·Ö¿ªÀ´£¬ÕâÑù¾ÍÓÐÁ½¸öÀà,dateºÍGregorianCalendar.Ò»¸öÓÃÀ´±íʾʱ¼äµã£¬Ò»¸öÓÃÀ´±íʾ´ó¼ÒÊìϤµÄÈÕÀú±íʾ·¨¡£ÊÂʵÉÏgregorianCalendarÀ©Õ¹ÁËÒ»¸ö¸ü¼ÓͨÓõÄÀ࣬Õâ¸öÀàÃèÊöÁËÈÕÀúµÄÒ»°ãÊôÐÔ¡£Date¿ÉÒÔÓëGregorianCalendar»¥Ïàת»¯£¬gregorianCalendarÓиö·½·¨getTimeµÃµ½date¶ÔÏó¡£»òÕßsetTime¿ÉÒÔ°ÑÒ»¸ödate¶ÔÏó¸øÈÕÀúÀà¡£
»ùÓÚÀàµÄ·ÃÎÊȨÏÞ
Ò»¸ö·½·¨¿ÉÒÔ·ÃÎÊËùÊôÀàµÄËùÓжÔÏóµÄ˽ÓÐÊý¾Ý£¬Ç¿°É£¡
class Employee{
private String name;
boolean equals(Employee other){
return name.equals(other.name);
}
}
nameÊÇ˽Óеģ¬µ«ÊÇÈ´¿ÉÒÔ·ÃÎÊËùÊôÀàEmployee¶ÔÏóµÄ˽ÓС£
private final Date hireDate;
½ö½öÒâζ×Å´¢´æÔÚhireDate±äÁ¿ÖеĶÔÏóÒýÓÃÔÚ¹¹ÔìÖ®ºó²»Äܱ»¸Ä±ä£¬µ«ÊDz¢²»ÒâζhireDateÊÇÒ»¸ö³£Á¿£¬ËûÒýÓõĶÔÏ󻹿ÉÒÔʹÓÃsetTime¸ü¸ÄÆ÷¸Ä±ä¡£
¾²Ì¬·½·¨¿ÉÒÔ·ÃÎÊ×ÔÉíÀàÖеľ²Ì¬Óò£¬ÒòΪËûÃǶ¼²»ÊǶԶÔÏó²Ù×÷£¬¶øÊÇÊôÓÚÀàµÄ¡£µ«ÊDz»ÄÜ·ÃÎÊʵÀýÓò¡£
ÿ¸öÎļþÖÐÖ»ÄÜÓÐÒ»¸ö¹«¹²À࣬²¢ÇÒÓëÎļþÃûÏàͬ£¬ÆäËûÀ಻ÄÜΪpublic¡£
·½·¨²ÎÊýµÄÁ½¸ö¸ÅÄî
Öµµ÷Óñíʾ·½·¨½ÓÊܵÄʵ÷ÓÃÕßÌṩµÄÖµ£¬¶øÒýÓõ÷Óñíʾ·½·¨½ÓÊܵÄÊǵ÷ÓÃÕßÌṩµÄ±äÁ¿µØÖ·¡£Ò»¸ö·½·¨¿ÉÒÔÐ޸Ĵ«µÝÒýÓÃËù¶ÔÓ¦µÄ±äÁ¿Öµ£¬¶ø²»ÄÜÐÞ¸ÄÖµµ÷ÓÃËù¶ÔÓ¦µÄ±äÁ¿Öµ¡£Java×ÜÊÇÖµµ÷Ó㬷½·¨µÃµ½µÄÊÇËùÓвÎÊýÖµµÄÒ»¸ö¿½±´£¬·½·¨²»ÄÜÐ޸Ĵ«µÝ¸øËûµÄÈκβÎÊý±äÁ¿µÄÄÚÈÝ¡£»ù±¾±äÁ¿¾Í²»ËµÁË£¬Èç¹û´«µÝµÄÊÇÒ»¸öÒýÓöÔÏóµØÖ·µÄ±äÁ¿Ò²ÊÇͬÑù£¬ÔÚ·½·¨Àï¿ÉÒԸıäÕâ¸ö±äÁ¿µÄÖµ£¬Ã²ËÆÒѾÐÞ¸ÄÁËÕâ¸ö±äÁ¿£¬ÄÇôÕâ¸ö±äÁ¿ÒýÓõÄÒ²²»ÊÇÄǸö¶ÔÏóµÄµØÖ·ÁË£¬µ«ÊdzöÁË·½·¨£¬ÄǸö±äÁ¿»¹ÊÇÒýÓõÄÄǸö¶ÔÏóµÄµØÖ·¡£Õâ¾ÍÊÇ˵JavaÀ´ËµÒ»Ö±¶¼ÊÇÖµµ÷Óá£ÓÀÔ¶²»»á¸Ä±ä´«µÝ¹ýÀ´µÄ²ÎÊý£¬ÒòΪÐ޸ĵÄÖ»ÊÇÕâЩ²ÎÊýµÄ¿½±´£¬²»¹ÜÊÇ»ù±¾ÀàÐ͵IJÎÊý£¬»¹ÊÇÒýÓöÔÏóµØÖ·µÄ±äÁ¿²ÎÊý¡£
×ܽáÒ»ÏÂJavaÉè¼ÆÓïÑÔÖз½·¨²ÎÊýµÄʹÓÃÇé¿ö
1. Ò»¸ö·½·¨²»ÄÜÐÞ¸ÄÒ»¸ö»ù±¾Êý¾ÝÀàÐ͵IJÎÊý
2. Ò»¸ö·½·¨¿ÉÒÔÐÞ¸ÄÒ»¸ö²ÎÊýÒýÓõĶÔÏóµÄ״̬¡£
3. Ò»¸ö·½·¨²»ÄÜʵÏÖÈöÔÏó²ÎÊýÒýÓÃÒ»¸öеĶÔÏó¡£
ÖØÔØ
Èç¹û¶à¸ö·½·¨ÓÐÏàͬµ
Ïà¹ØÎĵµ£º
Ŀ¼
ÕªÒª ……………………………………………………………………2
ÎÄÏ××ÛÊö ……………………&h ......
´úÀíģʽµÄ×÷ÓÃÊÇ£ºÎªÆäËû¶ÔÏóÌṩһÖÖ´úÀíÒÔ¿ØÖƶÔÕâ¸ö¶ÔÏóµÄ·ÃÎÊ¡£
ÔÚijЩÇé¿öÏ£¬Ò»¸ö¿Í»§²»Ïë»òÕß²»ÄÜÖ±½ÓÒýÓÃÁíÒ»¸ö¶ÔÏ󣬶ø´úÀí¶ÔÏó¿ÉÒÔÔÚ¿Í»§¶ËºÍÄ¿±ê¶ÔÏóÖ®¼äÆðµ½ÖнéµÄ×÷ÓÃ
ÀýÈ磺¿ÍÈËÏëÇëÊг¤(ÕæÊǽÇÉ«)³Ô·¹ µ«ÊÇÇë²»¶¯Êг¤ Ö»ºÃÕÒÊг¤ÃØÊé(´úÀí½ÇÉ«) µ«ÊÇ×îºóΪ¿ÍÈË×öÊ嵀 »¹ÊÇ ......
===================================TimerTask=======================================
import java.util.TimerTask;
import java.util.Calendar;
public class MyTask extends TimerTask
{
private ......
¶¯Ì¬´úÀíÊÇÖ¸¿Í»§Í¨¹ý´úÀíÀàÀ´µ÷ÓÃÆäËü¶ÔÏóµÄ·½·¨
¶¯Ì¬´úÀíʹÓó¡ºÏ:
•
Ô¶³Ì·½·¨µ÷ÓÃ(RMI)
•
1.´´½¨Ò»¸öʵÏÖ½Ó¿ÚInvocationHandlerµÄÀ࣬Ëü±ØÐëʵÏÖinvoke·½·¨
2.´´½¨±»´úÀíµÄÀàÒÔ¼°½Ó¿Ú
3.ͨ¹ýProxyµÄ¾²Ì¬·½·¨
newProxyInstance(ClassLoader loader, Class[] interfaces, Invocat ......
ÒÔÍùҪʹÓÃJava¶Ôʱ¼äÈÕÆÚ½øÐвÙ×÷£¬¿ÉÄÜ»áÓõ½ÒÔϵÄһЩÀࣺ
Date and its subclasses :
java.util.Date
java.sql.Date
java.sql.Timestamp
The calendar and time zone classes :
java.util.Calendar
java.util.GregorianCalendar
java.util.TimeZone
java.util.SimpleTimeZone
(for use with the Gregorian ......