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

Java ʱ¼ä²Ù×÷

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, 8);
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, 8);
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, 8);
cal.set(Calendar.DAY_OF_MONTH, 3);
cal.roll(Calendar.DATE, -4);
date=cal.getTime();
System.out.pri


Ïà¹ØÎĵµ£º

JAVAÅàѵÌâ¿â Struts

1. StrutsÌåϵ½á¹¹ÊµÏÖÁËMVCÉè¼ÆģʽµÄ¸ÅÄÄÇôËü½«ÒÔÏÂÑ¡ÏîÖиø³öµÄʲô·Ö±ðÓ³ÉäΪwebÓ¦ÓÃÖеÄ×é¼þ£¿£¨ £©
A  View
B  Model
C  ActionServlet
D  Action
E  ActionMapping
F  Controller
²Î¿¼´ð°¸£ºABF
2. ÔÚStrutsÌåϵ½á¹¹ÖУ¬ÒÔÏÂÄĸöÓÉ´ú±íϵͳ״̬ºÍÉÌÒµÂß¼­µÄActionÀ´¹¹½¨ ......

JAVA ÄÚ²¿ÀàµÄ¼òµ¥×ܽá

¶¨ÒåÔÚÒ»¸öÀàÄÚ²¿µÄÀà½ÐÄÚ²¿À࣬°üº¬ÄÚ²¿ÀàµÄÀà³ÆΪÍⲿÀà¡£ÄÚ²¿Àà¿ÉÒÔÉùÃ÷public¡¢protected¡¢privateµÈ·ÃÎÊÏÞÖÆ£¬¿ÉÒÔÉùÃ÷ΪabstractµÄ¹©ÆäËûÄÚ²¿Àà»òÍⲿÀà¼Ì³ÐÓëÀ©Õ¹£¬»òÕßÉùÃ÷Ϊstatic¡¢finalµÄ£¬Ò²¿ÉÒÔʵÏÖÌض¨µÄ½Ó¿Ú¡£staticµÄÄÚ²¿ÀàÐÐΪÉÏÏóÒ»¸ö¶ÀÁ¢µÄÀ࣬·ÇstaticÔÚÐÐΪÉÏÀàËÆÀàµÄÊôÐÔ»ò·½·¨ÇÒ½ûÖ¹ÉùÃ÷staticµÄ·½· ......

JavaÂÒÂëÔ­Òò

1¡¢Ò³Ãæ±àÂëÓëºǫ́Àà±àÂë²»Ò»Ö¡£
2¡¢ºǫ́ÀàÓëÊý¾Ý¿â½»»¥±£³ÖÊý¾Ýʱ²úÉúÂÒÂë¡£½â¾ö·½·¨£º¿ÉÒÔÔÚÇý¶¯µÄurl²ÎÊýÖÐÖ¸¶¨¡£
3¡¢¶ÁÎļþ/Á÷ʱ²úÉúÂÒÂë¡£½â¾ö·½·¨£º½¨ÒéʹÓÃFileReaderºÍFileWriterµÄ¸¸ÀࣺInputStreamReader/OutputStreamWriter£¬ËüÃÇÔÚ¹¹Ô캯ÊýÖпÉÒÔÖ¸¶¨±àÂëÀàÐÍ£ºInputStreamReader(InputStream in, Charset c ......

java(Web)ÖÐÏà¶Ô·¾¶£¬¾ø¶Ô·¾¶ÎÊÌâ×ܽá

1.»ù±¾¸ÅÄîµÄÀí½â
¡¡¡¡¾ø¶Ô·¾¶£º¾ø¶Ô·¾¶¾ÍÊÇÄãµÄÖ÷Ò³ÉϵÄÎļþ»òĿ¼ÔÚÓ²ÅÌÉÏÕæÕýµÄ·¾¶£¬(URLºÍÎïÀí·¾¶)ÀýÈ磺
C:\xyz\test.txt ´ú±íÁËtest.txtÎļþµÄ¾ø¶Ô·¾¶¡£http://www.sun.com/index.htmÒ²´ú±íÁËÒ»¸ö
URL¾ø¶Ô·¾¶¡£
¡¡¡¡Ïà¶Ô·¾¶£ºÏà¶ÔÓëij¸ö»ù׼Ŀ¼µÄ·¾¶¡£°üº¬WebµÄÏà¶Ô·¾¶£¨HTMLÖеÄÏà¶ÔĿ¼£©£¬ÀýÈ磺ÔÚ ......

JAVAÖеĴ«µÝ¶¼ÊÇÖµ´«µÝÂð£¿ÓÐûÓÐÒýÓô«µÝÄØ£¿

JAVAÖеĴ«µÝ¶¼ÊÇÖµ´«µÝÂð£¿ÓÐûÓÐÒýÓô«µÝÄØ£¿
ÔڻشðÕâÁ½¸öÎÊÌâÇ°£¬ÈÃÎÒÃÇÊ×ÏÈÀ´¿´Ò»¶Î´úÂ룺
Java´úÂë
public class ParamTest {
// ³õʼֵΪ0
protected int num = 0;
// Ϊ·½·¨²ÎÊýÖØи³Öµ
public void change(int i) {
i = 5;
}
// Ϊ·½·¨²ÎÊýÖØи³Öµ
public void change(ParamTest t) {
P ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ