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

javaÈÕÆÚ¼¼ÇÉ×ܽá

¼ÆËã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();k
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.prin


Ïà¹ØÎĵµ£º

java·ºÐÍÏê½â

·ºÐÍ£¨Generic type »òÕßgenerics£©ÊÇ¶Ô Java ÓïÑÔµÄÀàÐÍϵͳµÄÒ»ÖÖÀ©Õ¹£¬ÒÔÖ§³Ö´´½¨¿ÉÒÔ°´ÀàÐͽøÐвÎÊý»¯µÄÀà¡£¿ÉÒÔ°ÑÀàÐͲÎÊý¿´×÷ÊÇʹÓòÎÊý»¯ÀàÐÍʱָ¶¨µÄÀàÐ͵ÄÒ»¸öռλ·û£¬¾ÍÏñ·½·¨µÄÐÎʽ²ÎÊýÊÇÔËÐÐʱ´«µÝµÄÖµµÄռλ·ûÒ»Ñù¡£
¿ÉÒÔÔÚ¼¯ºÏ¿ò¼Ü£¨Collection framework£©Öп´µ½·ºÐ͵Ķ¯»ú¡£ÀýÈ磬MapÀàÔÊÐíÄúÏòÒ»¸öMapÌí ......

JAVA¼¯ºÏÀà


java.util°üÖоͰüº¬ÁËһϵÁÐÖØÒªµÄ¼¯ºÏÀ࣬¶ø¶ÔÓÚ¼¯ºÏÀ࣬Ö÷ÒªÐèÒªÕÆÎյľÍÊÇËüµÄÄÚ²¿½á¹¹£¬ÒÔ¼°±éÀú¼¯ºÏµÄµü´úģʽ¡£
½Ó¿Ú£ºCollection
ËùÓм¯ºÏÀàµÄ¸ùÀàÐÍ£¬Ö÷ÒªµÄÒ»¸ö½Ó¿Ú·½·¨£ºboolean add(Ojbect c)Ëä·µ»ØµÄÊÇboolean£¬µ«²»ÊDZíʾÌí¼Ó³É¹¦Óë·ñ£¬ÒòΪCollection¹æ¶¨£ºÒ»¸ö¼¯ºÏ¾Ü¾øÌí¼ÓÕâ¸öÔªËØ£¬ÎÞÂÛʲôԭÒò£¬¶¼± ......

Beginning Java AWT and Swing in NetBeans

Ò»¡¢ÐÔÄÜÎÊÌâ
Ëæ×ÅJava 6¶ÔÓÚSwingÐÔÄܵĸĽø£¬SwingµÄÔËÐÐËÙ¶ÈÒѾ­¿ªÊ¼µÃµ½ÁË´ó´óµÄÌá¸ß£¬¿´¿´NetBeans¾ÍÖªµÀÁË£¬NetBeans¾ÍÊÇSwing¿ª·¢µÄ£¬Èç¹ûÄãÅÜSwingºÜÂý£¬ºÜºÄ×ÊÔ´£¬ÄÇôӦ¸Ã´Ó×Ô¼ºµÄ³ÌÐòÉÏÕÒÕÒÎÊÌ⣬ÍƼöʹÓÃNetBeans×Ô´øµÄProfile²éÕÒÔ­Òò£¬½Ì³ÌÔÚÕâÀï – Profile Introduce.
¶þ¡¢LookAndFeel
ÓÃSwing×öÆó ......

java clone

java clone
ÎÄÕ·ÖÀà:Java±à³Ì ¹Ø¼ü×Ö: java clone
1.javaÀïµÄclone·ÖΪ£º
A:dz¸´ÖÆ£¨Ç³¿Ë¡£©: dz¸´Öƽö½ö¸´ÖÆËù¿¼ÂǵĶÔÏ󣬶ø²»¸´ÖÆËüËùÒýÓõĶÔÏó¡£
b:ÉÖÆ£¨Éî¿Ë¡£©£ºÉÖÆ°ÑÒª¸´ÖƵĶÔÏóËùÒýÓõĶÔÏ󶼸´ÖÆÁËÒ»±é¡£
JavaÖжÔÏóµÄ¿Ë¡,ΪÁË»ñÈ¡¶ÔÏóµÄÒ»·Ý¿½±´£¬ÎÒÃÇ¿ÉÒÔÀûÓÃObjectÀàµÄclone()·½·¨¡£±ØÐëÒª ......

java ÖÐÀàÐÍת»»¹æÔò

Ê×ÏÈboolean²»ÄܸúÆäËûÀàÐÍת»»¡£
1.¸³ÖµÊ±£º
               ÕûÊýĬÈϵÄÊÇint  ¸¡µãĬÈÏÊÇdouble£¬¼´ÕûÐ͵ȺÅÓÒ²àÈ«²¿×Ô¶¯×ª»¯Îªint£¬¸¡µãÐ͵ȺÅÓÒ²à×Ô¶¯×ª»»Îªdouble¡£µ±´óÈÝÁ¿µÄÊý¾ÝÀàÐ͸³Öµ¸øСÈÝÁ¿µÄÊý¾ÝÀàÐÍʱ ÐèҪǿÖÆÀàÐÍת»»µ«ÊÇÓÐ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ