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

javaÖйØÓÚʱ¼äÈÕÆÚ²Ù×÷µÄ³£Óú¯Êý

1.¼ÆËãijһÔ·ݵÄ×î´óÌìÊý
Calendar time=Calendar.getInstance();
time.clear();
time.set(Calendar.YEAR,year);
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");
System.out.println(df.format(date));
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.println(df.format(date));
cal.roll(Calendar.DATE, 4);
date=cal.g


Ïà¹ØÎĵµ£º

¡¶javaÓïÑÔ³ÌÐòÉè¼Æ£¨Ò»£©¡·2009Äê×Ôѧ¿¼ÊÔ´ó¸ÙµÚ8ÕÂ


µÚ8Õ ¶àÏß³Ì
(Ò»)¿Î³ÌÄÚÈÝ
8.1Ï̵߳Ļù±¾¸ÅÄî
8.1.1Ï̵߳ÄÉúÃüÖÜÆÚ
8.1.2Ï̵߳÷¶ÈÓëÓÅÏȼ¶
8.2 ThreadÀàºÍRunnable½Ó13
8.2.1 ThreadÀà
8.2.2 Runnable½Ó¿Ú
8.3Ï̻߳¥³âºÍͬ²½
8.3.1Ï̻߳¥³â
8.3.2Ïß³Ìͬ²½
(¶þ)ѧϰĿµÄÓëÒªÇó
±¾Õ½éÉܶàÏ̵߳ĸÅÄîºÍ±àд¶àÏ̳߳ÌÐòµÄ·½·¨£¬ÊµÏÖÏß³ÌÖ®¼äÏ໥ͨÐźÍͬ²½µÄ¼¼ ......

¡¶javaÓïÑÔ³ÌÐòÉè¼Æ£¨Ò»£©¡·2009Äê×Ôѧ¿¼ÊÔ´ó¸ÙµÚ9ÕÂ

µÚ9Õ ÊäÈëºÍÊä³öÁ÷
(Ò»)¿Î³ÌÄÚÈÝ
9.1×Ö½ÚÁ÷ºÍ×Ö·ûÁ÷
9.1.1 File¶ÔÏó
9.1.2Á÷¶ÔÏó
9.2»º³åʽÊäÈëÊä³ö
9.2.1»º³åʽÊäÈë
9.2.2»º³åʽÊä³ö
9.3Ëæ»ú·ÃÎÊ
9.4Îļþ¶Ô»°¿ò
(¶þ)ѧϰĿµÄÓëÒªÇó
±¾Õ½éÉÜJava³ÌÐòÊý¾ÝÎļþµÄÊäÈëÊä³ö¼¼Êõ¡£ÒªÇóÄܱàд¼òµ¥µÄJavaÎļþ´¦Àí³ÌÐò¡£
(Èý)¿¼ºË֪ʶµãÓ뿼ºËÒªÇó
1.´´½¨File¶ÔÏó£ ......

Javaµ÷ÓÃC#µÄWebServiceʵÀýÈý(ʵ¼ÊÓ¦ÓÃ)

/*
   ±¾¶Î´úÂëÔÚ¹«Ë¾ÏîÄ¿ÖÐʵ¼ÊÔ¶³Ìµ÷ÓõÚÈý·½¹«Ë¾ÌṩµÄC#¿ª·¢WebServiceµÄʾÀý
*/
/**
  * µÇ¼ÓÎÏ·
  *
  * @param paramPN
  * @param paramTerraceID
  * @param paramSvrID
  */
 private String loginGame(String paramPN, HttpServletRequest req){
&n ......

Java֮staticѧϰ

¶ÔÓÚѧϰstaticÎÒÃÇÏÈÀ´¿´Á½¸öÀý×Ó£º
//Example 1 Tst.java£¬no main() method
package com.blogchina.qb2049;
public class Tst
{
static { System.out.println("111111"); }
}
ÔËÐнá¹ûΪ: 111111
Exception in thread "main" java.lang.NoSuchMethodError: main
ͬÑùµÄµÀÀí¿´µÚ¶þ ......

JAVA List to Array,Array to List

 1.Listת»»³ÉΪÊý×é¡££¨ÕâÀïµÄListÊÇʵÌåÊÇArrayList)
µ÷ÓÃArrayListµÄtoArray·½·¨¡£
Àý£ºString[] arr = (String[])list.toArray(new String[size]);
2.Êý×éת»»³ÉΪList¡£
µ÷ÓÃArraysµÄasList·½·¨¡£
Àý£ºList stooges = Arrays.asList("Larry", "Moe", "Curly"); ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ