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

Java data ×ܽá

1.¼ÆËãijһÔ·ݵÄ×î´óÌìÊý
Calendar time=Calendar.getInstance();
time.clear();
time.set(Calendar.YEAR,year); //year Ϊ int
time.set(Calendar.MONTH,i-1);//×¢Òâ,Calendar¶ÔÏóĬÈÏÒ»ÔÂΪ0
int day=time.getActualMaximum(Calendar.DAY_OF_MONTH);//±¾Ô·ݵÄÌìÊý
×¢£ºÔÚʹÓÃset·½·¨Ö®Ç°£¬±ØÐëÏÈclearһϣ¬·ñÔòºÜ¶àÐÅÏ¢»á¼Ì³Ð×Ôϵͳµ±Ç°Ê±¼ä
2.CalendarºÍDateµÄת»¯
(1) Calendarת»¯ÎªDate
Calendar cal=Calendar.getInstance();
Date date=cal.getTime();
(2) Dateת»¯ÎªCalendar
Date date=new Date();
Calendar cal=Calendar.getInstance();
cal.setTime(date);
3.¸ñʽ»¯Êä³öÈÕÆÚʱ¼ä £¨Õâ¸öÓõıȽ϶ࣩ
Date date=new Date();
SimpleDateFormat df=new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
String time=df.format(date);
System.out.println(time);
4.¼ÆËãÒ»ÄêÖеĵڼ¸ÐÇÆÚ
(1)¼ÆËãijһÌìÊÇÒ»ÄêÖеĵڼ¸ÐÇÆÚ
Calendar cal=Calendar.getInstance();
cal.set(Calendar.YEAR, 2006);
cal.set(Calendar.MONTH,;
cal.set(Calendar.DAY_OF_MONTH, 3);
int weekno=cal.get(Calendar.WEEK_OF_YEAR);
(2)¼ÆËãÒ»ÄêÖеĵڼ¸ÐÇÆÚÊǼ¸ºÅ
SimpleDateFormat df=new SimpleDateFormat("yyyy-MM-dd");
Calendar cal=Calendar.getInstance();
cal.set(Calendar.YEAR, 2006);
cal.set(Calendar.WEEK_OF_YEAR, 1);
cal.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
System.out.println(df.format(cal.getTime()));
Êä³ö:
2006-01-02
5.add()ºÍroll()µÄÓ÷¨(²»Ì«³£ÓÃ)
(1)add()·½·¨
SimpleDateFormat df=new SimpleDateFormat("yyyy-MM-dd");
Calendar cal=Calendar.getInstance();
cal.set(Calendar.YEAR, 2006);
cal.set(Calendar.MONTH,;
cal.set(Calendar.DAY_OF_MONTH, 3);
cal.add(Calendar.DATE, -4);
Date date=cal.getTime();
System.out.println(df.format(date));
cal.add(Calendar.DATE, 4);
date=cal.getTime();
System.out.println(df.format(date));
Êä³ö£º
2006-08-30
2006-09-03
(2)roll·½·¨
cal.set(Calendar.YEAR, 2006);
cal.set(Calendar.MONTH,;
cal.set(Calendar.DAY_OF_MONTH, 3);
cal.roll(Calendar.DATE, -4);
date=cal.getTime();
System.out.println(df.format(date));
cal.roll


Ïà¹ØÎĵµ£º

java²¢·¢±à³Ìʵ¼ù ±Ê¼Ç£¨1£©

Ḭ̈߳²È« ʲôÊÇḬ̈߳²È«(thread-safe)£¿ Ò»¸öÀ࣬Èç¹ûÄܹ»ÔÚ¶àÏ̲߳¢·¢·ÃÎʵĻ·¾³Ï£¨²»¹ÜÏ̷߳ÃÎʵÄ˳Ðò£©ÕýÈ·±íÏÖ×Ô¼ºµÄÐÐΪ£¬²¢ÇÒÎÞÐèÍⲿµ÷ÓÃÌí¼ÓÈκÎͬ²½Ö®ÀàµÄ²Ù×÷£¬Õâ¸öÀà¾ÍÊÇḬ̈߳²È«µÄ¡£
Õâ¸öÕýÈ·ÐÔ¿ÉÒÔÕâôÀí½â£¬¾ÍÊÇ˵¶àÏ̷߳ÃÎʵĽá¹û²»»á²»Í¬ÓÚµ¥Ï̵߳ķÃÎÊ¡£
Ḭ̈߳²È«µÄÀ಻ÐèÒªÍⲿµ÷ÓÃÌá¹©È ......

ÓÃÉè¼ÆģʽµÄ˼ÏëÀ´¶¨ÖÆJavaÖеÄʼþ

¼¶±ð£º ³õ¼¶
ÌÆ
ÏÌ·å
(hutun@263.net
),
2001 Äê 5 ÔÂ 28 ÈÕ
Ëæ×ÅJAVAµÄѸÃÍ·¢Õ¹£¬JDK°æ±¾µÄ²»¶Ï¸ü
У¬JAVAеÄʼþÄ£ÐÍÓë¾ÉµÄJDKÄ£ÐÍÒ²ÓÐÁ˱¾ÖʵÄÇø±ð£¬ËüµÄʼþÄ£ÐÍÒ²ÓÐÁ˺ܴóµÄÇø±ð¡£ÓÉÓÚÏÖÔڵıà³Ì¶¼ÊDzÉÓÃʼþÇý¶¯£¬ËùÒÔºÜÓбØÒªÁ˽âµÄʼþÄ£
ÐÍ£¬ÎÒÃÇÏÂÃæ´Ó¶¨ÖÆʼþµÄʵ¼Ê³ö·¢À´¾ßÌåÌÖÂÛ¡£
ÎÊÌâµÄÌá³ö
......

¸ßЧÂÊjava±à³Ì

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

JavaÖжÔHashMapµÄÉî¶È·ÖÎö

ÔÚJavaµÄÊÀ½çÀÎÞÂÛÀ໹ÊǸ÷ÖÖÊý¾Ý£¬Æä½á¹¹µÄ´¦ÀíÊÇÕû¸ö³ÌÐòµÄÂß¼­ÒÔ¼°ÐÔÄܵĹؼü¡£ÓÉÓÚ±¾È˽Ӵ¥ÁËÒ»¸öÓйØÐÔÄÜÓëÂß¼­Í¬Ê±²¢´æµÄÎÊÌ⣬ÓÚÊǾͿªÊ¼Ñо¿Õâ·½ÃæµÄÎÊÌâ¡£ÕÒ±éÁË´ó´óССµÄÂÛ̳£¬Ò²°Ñ¡¶Java ÐéÄâ»ú¹æ·¶¡·£¬¡¶apress,.java.collections.(2001),.bm.ocr.6.0.shareconnector¡·£¬ºÍ¡¶Thinking in Java¡··­ÁËÒ²ÕÒ²»µ ......

JAVA Öн«×Ö·û´®×ª»»³ÉÀàʵÀý¶ÔÏó

ÔںܶàʱºòÎÒÃÇÐèÒª½«Ò»¸ö¸øÁËÍêÕû·¾¶µÄÀà¶ÔÏó×Ö·û´®×ª»»³ÉÒ»¸öÀàµÄʵÀý¶ÔÏ󣬾ͱÈÈç˵ÓÐÒÔÏÂÕâÑùµÄÒ»¸ö×Ö·û´®
String  menAction= "gef.putin.step.ui.SystemMenuTest(xiajiaji)"ÔÚ¸ÃÀàÖÐÐèÒªÓÐÓÐÒ»¸ö×Ö·û´®¸ñʽµÄ²ÎÊý£¬µ±È»¶à¸ö²ÎÊýÒ²¿ÉÒÔ£¬ÎÒÒѾ­½«¶à¸ö²ÎÊýµÄ¿¼ÂǽøÈ¥£¬¶Ô¸Ä×Ö·û´®½øÐнâÎö¾Í¿ÉÒÔת»»³ÉÀàµÄʵÀý¶Ô ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ