Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

JavaÈÕÆÚ ¼ÆËã

JavaÖÐÌṩÁ˷ḻµÄÈÕÆÚ±íʾ·½Ê½¡£ÆäÖаüÀ¨Date¡¢Timestamp¡¢Calendar¡¢GregorianCalendarÀà¡£GregorianCalendarÀàÖÐÌṩÁËÓÃÓÚ¼ÆËãÈÕÆÚµÄadd()·½·¨£¬¿ÉÒԺܷ½±ãµØ¼ÆËãÈô¸ÉÄê¡¢Ô¡¢ÈÕºóµÄÈÕÆÚ¡£

¸ø¸öÀý×Ó¿´¿´£º


package testjava;

import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.GregorianCalendar;

public class DateTest {

public static void main(String[] args) {

SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
DateTest test = new DateTest();
//Date
Date currentDate = new Date();
System.out.println("µ±Ç°ÈÕÆÚÊÇ£º" + df.format(currentDate));
System.out.println("Ò»ÖܺóµÄÈÕÆÚÊÇ£º" + df.format(test.nextWeek(currentDate)));
System.out.println("Ò»ÔºóµÄÈÕÆÚÊÇ£º" + df.format(test.nextMonth(currentDate)));
System.out.println("Ò»ÄêºóµÄÈÕÆÚÊÇ£º" + df.format(test.nextYear(currentDate)));
//Timestamp
Timestamp currentTime = new Timestamp(System.currentTimeMillis());
System.out.println("µ±Ç°ÈÕÆÚÊÇ£º" + df.format(currentTime));
System.out.println("Ò»ÖܺóµÄÈÕÆÚÊÇ£º" + df.format(test.nextWeek(currentTime)));
System.out.println("Ò»ÔºóµÄÈÕÆÚÊÇ£º" + df.format(test.nextMonth(currentTime)));
System.out.println("Ò»ÄêºóµÄÈÕÆÚÊÇ£º" + df.format(test.nextYear(currentTime)));

//ÁíÒ»ÖÖ¼ÆË㷽ʽ£¬ÕâÖÖ·½Ê½¼ÆËãÔºÍÄêµÄÈÕÆÚ±È½ÏÀ§ÄÑ
Timestamp nextTime = new Timestamp(currentTime.getTime() + 7 * 24 * 60 * 60 * 1000);
System.out.println("µ±Ç°ÈÕÆÚÊÇ£º" + df.format(currentTime));
System.out.println("Ò»ÖܺóµÄÈÕÆÚÊÇ£º" + df.format(nextTime));

}

//»ñÈ¡ÏÂÒ»ÖܵÄÈÕÆÚ
public Date nextWeek(Date currentDate) {
GregorianCalendar cal = new GregorianCalendar();
cal.setTime(currentDate);
cal.add(GregorianCalendar.DATE, 7);//ÔÚÈÕÆÚÉϼÓ7Ìì
return cal.getTime();
}

//»ñÈ¡±¾ÖÜÈÕµÄÈÕÆÚ
public Date getSunday(Date monday) {
GregorianCalendar cal = new GregorianCalendar();
cal.setTime(monday);
cal.add(GregorianCalendar.DATE, 6);//ÔÚÈÕÆÚÉϼÓ6Ìì
return cal.getTime();
}

//»ñÈ¡ÏÂÒ»ÔµÄÈÕÆÚ
public Date nextMo


Ïà¹ØÎĵµ£º

¸ßЧÂÊjava±à³Ì

1:¿¼ÂÇʹÓþ²Ì¬¹¤³§·½·¨´úÌæ¹¹¹¹·½·¨À´ÊµÀý»¯Àà¡£
2£ºÊ¹ÓÃ˽Óù¹¹¹º¯Êý£¬Ê¹Àà¾ßÓв»¿ÉʵÀý»¯µÄÄÜÁ¦¡£
3£º±ÜÃâ´´½¨Öظ´µÄ¶ÔÏó
4£ºÏû³ý¹ýÆÚµÄ¶ÔÏóµÄʹÓÃ
5£º±ÜÃâʹÓÃÖսắÊý
6£ºÊ¹ÀàºÍ³ÉÔ±µÄ¿É·ÃÎÊÐÔ×îС
7£º½Ó¿ÚÓÅÏÈÓÚ³éÏó
8£ºÎªËùÓеIJÎÊý½øÐÐÓÐЧÐÔ¼ì²é
9£º½÷É÷ʹÓÃÖØÔØ
10£ºÊ¹ÓÃ0³¤¶ÈµÄÊý×飬¶ø²»ÊÇ¿Õ
11£º½«¾ ......

java equalsÓë== µÄÇø±ð

equals ·½·¨ÊÇ java.lang.Object ÀàµÄ·½·¨¡£
ÓÐÁ½ÖÖÓ÷¨ËµÃ÷£º
£¨1£©¶ÔÓÚ×Ö·û´®±äÁ¿À´Ëµ£¬Ê¹ÓÓ==”ºÍ“equals()”·½·¨±È½Ï×Ö·û´®Ê±£¬Æä±È½Ï·½·¨²»Í¬¡£
“==”±È½ÏÁ½¸ö±äÁ¿±¾ÉíµÄÖµ£¬¼´Á½¸ö¶ÔÏóÔÚÄÚ´æÖеÄÊ×µØÖ·¡£
“equals()”±È½Ï×Ö·û´®ÖÐËù°üº¬µÄÄÚÈÝÊÇ·ñÏàͬ¡£
±ÈÈ磺 ......

Google App engine for Java¿ª·¢µÄÒ»¸ö²©¿ÍÍøÕ¾

»¥ÁªÍø³åÀ˰壬ÊÇGoogle app Engine ÔÆ¼ÆËãÆ½Ì¨ÉϵÄÒ»¸ö²©¿Í£¬ÊÇ»ùÓÚGoogle App engine for Java¿ª·¢µÄ¡£
ԭʼµÄÒâͼÊÇÒòΪٶù»¹Ð¡£¬ÏÖÔÚ»¹²»»áÔĶÁ£¬¶øÎÒÔÚÉÏÍøÊ±¾­³£¿´µ½Ò»Ð©ÓÐÒæÓÐȤÉõÖÁ¿ÉÒÔ°ïÖúѧϰµÄһЩÄÚÈÝ£¬¾ÍÏë°ÑËü¼ÇÏÂÀ´Ð´ÔÚ²©¿ÍÀ¹©Å®¶ù³¤´óÔÙÈ¥¿´¿´¡£
ÁíÍ⣬ÎÒ»¹Ã»Óз¢ÏÖGoogle App engine for Java¿ª·¢µÄ ......

Sun Java moved to the Partner repository

For Ubuntu 10.04 LTS, the sun-java6 packages have been dropped from the Multiverse section of the Ubuntu archive. It is recommended that you use openjdk-6 instead.
If you can not switch from the proprietary Sun JDK/JRE to OpenJDK, you can install sun-java6 packages from the Canonical Partner Reposi ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ