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

³£ÓÃJava Date·½·¨

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
 &


Ïà¹ØÎĵµ£º

Java NIO APIÏê½â

 
Java NIO APIÏê½â
ÔÚJDK
1.4ÒÔÇ°£¬JavaµÄIO²Ù×÷¼¯ÖÐÔÚjava.ioÕâ¸ö°üÖУ¬ÊÇ»ùÓÚÁ÷µÄ×èÈû£¨blocking£©API¡£¶ÔÓÚ´ó¶àÊýÓ¦ÓÃÀ´Ëµ£¬ÕâÑùµÄAPIʹÓúܷ½
±ã£¬È»¶ø£¬Ò»Ð©¶ÔÐÔÄÜÒªÇó½Ï¸ßµÄÓ¦Óã¬ÓÈÆäÊÇ·þÎñ¶ËÓ¦Óã¬ÍùÍùÐèÒªÒ»¸ö¸üΪÓÐЧµÄ·½Ê½À´´¦ÀíIO¡£´ÓJDK 1.4Æð£¬NIO
API×÷Ϊһ¸ö»ùÓÚ»º³åÇø£¬²¢ÄÜÌṩ·Ç×èÈû(non-blo ......

javaËæ»úÅÅÁÐÊý×é

ÓÐʱÎÒÃÇÐèÒªËæ»úµÄÅÅÁÐÊý×éÖеÄÔªËØ£¬Ëæ»úÅÅÁÐÊý×飬Ŀǰ³£ÓõÄÓÐÁ½ÖÖ·½·¨£¬µÚÒ»ÖÖ¾ÍÊÇÔªËØA[i]¶ÔÓ¦Ò»¸öÓÅÏȼ¶P[i],¸ù¾ÝÓÅÏȼ¶×÷Ϊ¼üÖµÀ´´ÓÐÂÅÅÐòÊý×é;µÚ¶þÖÖ·½·¨¾ÍÊÇA[i]Ëæ»úµÄ¸úA[i]µ½A[n]ÖеÄÈÎÒâ¸öÔªËؽøÐн»»»,nΪÊý×éµÄ³¤¶È,ÏÂÃæÊÇÓÃjavaʵÏÖÒ»¸ö¼òµ¥ÊµÏÖ.
import java.util.Date;
import java.util.Random;
/*
......

JAVAͨÓÃDao½Ó¿ÚºÍhibernateµÄ¾ßÌåʵÏÖ

»ùÓÚ·ºÐ͵ÄͨÓÃDao½Ó¿Ú£º£¨ÖØÒªÊÇÔÚÓ¦ÓÃhibernate»òJPAʱÔËÓã©
¡¡¡¡package com.qiujy.dao;
¡¡¡¡import java.io.Serializable;
¡¡¡¡import java.util.List;
¡¡¡¡/**
¡¡¡¡* »ùÓÚ·ºÐ͵ÄͨÓÃDao½Ó¿Ú
¡¡¡¡*/
¡¡¡¡public interface GenericDao {
¡¡¡¡void create(T entity);
¡¡¡¡void delete(T entity);
¡¡ ......

ÓÃÓÚWEBÓ¦ÓõÄJava¼¼Êõ¼ò½é


×÷ÕߣºDana Nourie£¬2006.11
·­Ò룺ïúÖ¾¹ú£¬2009.12
Äã¿ÉÒÔÔÚInternetÉÏ¿´µ½µ½´¦¶¼ÊÇWEBÓ¦Óᣴ󲿷ֵÄWEBÓ¦ÓÃÓÃÀ´´¦ÀíÔÚÏß±íµ¥£¬Í¶Æ±£¬´¦ÀíÔÚÏßÉ̵궩µ¥£¬º½°àÔ¤¶©£¬»òÕßÊǼòµ¥µØÏÔʾÓû§µÇ¼
Ãû³Æ¡£ÄÇô£¬´´½¨WEBÓ¦ÓÃʱÓõ½ÄÄЩJava¼¼ÊõÄØ£¿ÄãÐèÒªµ¼ÈëÄÄЩ°üÄØ£¿ÕâЩҪ¿´Äã´´½¨µÄÊÇÄÄÖÖWEBÓ¦ÓÃÒÔ¼°Ëü×öʲô¶ø¶¨¡£
± ......

java .classÓëgetClassµÄÇø±ð

.classÆäʵÊÇÔÚjavaÔËÐÐʱ¾Í¼ÓÔؽøÈ¥µÄ
getClass()ÊÇÔËÐгÌÐòʱ¶¯Ì¬¼ÓÔصÄ
ÏÂÃæÒÔÀý×Ó˵Ã÷:
Ê×ÏȽ¨Ò»¸ö»ùÀàBaseclass
package classyongfa;
public class Baseclass {
private String height;
public String getHeight()
{
   return height;
}
public void setHeight(String height)
{
 
&n ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ