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
Ïà¹ØÎĵµ£º
ÏÈÀ´Á˽âÒ»ÏÂÁ´±íģʽµÄÔÀí£º
Ê×ÏÈдһ¸öJavaBean£¬ÄÚÈÝÊÇÒªÌí¼ÓµÄÔªËغ͸ÃÔªËصĽڵ㡣
public class NodeBean implements Serializable
{
private Object data; //ÔªËر¾Éí
private NodeBean next; //ÏÂÒ»¸ö½Úµã
&n ......
ûÓбØÒªÓÃÒ»¶ÑÈÆ¿ÚµÄÐÎÈÝ´ÊÀ´ÃèÊöʲô½Ð¶à̬£¬Ö»¾Ù³ö¼¸¸ö¹Ø¼üµã¡£
É裺gunΪ¸¸À࣬shootgunºÍpistolΪgunµÄ×ÓÀà¡£
Java:
class gun {
void shoot() {
  ......
¼¶±ð£º ³õ¼¶
ÌÆ
ÏÌ·å
(hutun@263.net
),
2001 Äê 5 ÔÂ 28 ÈÕ
Ëæ×ÅJAVAµÄѸÃÍ·¢Õ¹£¬JDK°æ±¾µÄ²»¶Ï¸ü
У¬JAVAеÄʼþÄ£ÐÍÓë¾ÉµÄJDKÄ£ÐÍÒ²ÓÐÁ˱¾ÖʵÄÇø±ð£¬ËüµÄʼþÄ£ÐÍÒ²ÓÐÁ˺ܴóµÄÇø±ð¡£ÓÉÓÚÏÖÔڵıà³Ì¶¼ÊDzÉÓÃʼþÇý¶¯£¬ËùÒÔºÜÓбØÒªÁ˽âµÄʼþÄ£
ÐÍ£¬ÎÒÃÇÏÂÃæ´Ó¶¨ÖÆʼþµÄʵ¼Ê³ö·¢À´¾ßÌåÌÖÂÛ¡£
ÎÊÌâµÄÌá³ö
......
1:¿¼ÂÇʹÓþ²Ì¬¹¤³§·½·¨´úÌæ¹¹¹¹·½·¨À´ÊµÀý»¯Àà¡£
2£ºÊ¹ÓÃ˽Óù¹¹¹º¯Êý£¬Ê¹Àà¾ßÓв»¿ÉʵÀý»¯µÄÄÜÁ¦¡£
3£º±ÜÃâ´´½¨Öظ´µÄ¶ÔÏó
4£ºÏû³ý¹ýÆڵĶÔÏóµÄʹÓÃ
5£º±ÜÃâʹÓÃÖսắÊý
6£ºÊ¹ÀàºÍ³ÉÔ±µÄ¿É·ÃÎÊÐÔ×îС
7£º½Ó¿ÚÓÅÏÈÓÚ³éÏó
8£ºÎªËùÓеIJÎÊý½øÐÐÓÐЧÐÔ¼ì²é
9£º½÷É÷ʹÓÃÖØÔØ
10£ºÊ¹ÓÃ0³¤¶ÈµÄÊý×飬¶ø²»ÊÇ¿Õ
11£º½«¾ ......
Ó¢ÎÄÔÎĵØÖ·:
http://www.onjava.com/pub/a/onjava/2005/07/06/generics.html
ÖÐÎĵØÖ·:
http://www.matrix.org.cn/resource/article/43/43634_java_generics.html
¹Ø¼ü´Ê£º java generics java5
ÕªÒª
·ºÐÍÊÇJ2SE 5.0×îÖØÒªµÄÌØÐÔ¡£ËûÃÇÈÃÄãдһ¸ötype(Àà»ò½Ó¿Ú£©ºÍ´´½¨Ò»¸ö ......