java ö¾ÙÀàÐÍ
Tiger ÖеÄÒ»¸öÖØÒªÐÂÌØÐÔÊÇö¾Ù¹¹Ô죬ËüÊÇÒ»ÖÖеÄÀàÐÍ£¬ÔÊÐíÓó£Á¿À´±íʾÌض¨µÄÊý¾Ý Ƭ¶Ï£¬¶øÇÒÈ«²¿¶¼ÒÔÀàÐÍ°²È«µÄÐÎʽÀ´±íʾ¡£Tiger ר¼Ò¡¢developerWorks µÄ¶à²ú×÷Õß Brett McLaughlin½«½âÊÍö¾ÙµÄ¶¨Ò壬½éÉÜÈçºÎÔÚÓ¦ÓóÌÐòÖÐÔËÓÃö¾Ù£¬ÒÔ¼°ËüΪʲôÄܹ»ÈÃÄúÅ×ÆúËùÓоɵÄ
public static final ´úÂë¡£
ÄúÒѾ֪µÀ£¬Java ´úÂëµÄÁ½¸ö»ù±¾µÄ¹¹Ôì¿éÊÇÀà ºÍ½Ó¿Ú¡£ÏÖÔÚ Tiger ÓÖÒýÈëÁËö¾Ù£¬Ò»°ã¼ò³ÆËüΪ enum¡£Õâ¸öÐÂÀàÐÍÔÊÐíÄú±íʾÌض¨µÄÊý¾Ýµã£¬ÕâЩÊý¾ÝµãÖ»½ÓÊÜ·ÖÅäʱԤÏȶ¨ ÒåµÄÖµ¼¯ºÏ¡£
µ±È»£¬ÊìÁ·µÄ³ÌÐòÔ±¿ÉÒÔÓþ²Ì¬³£Á¿ÊµÏÖÕâÏÄÜ£¬ÈçÇåµ¥ 1 Ëùʾ£º
Çåµ¥ 1. public static final µÄ³£Á¿
public class OldGrade {
public static final int A = 1;
public static final int B = 2;
public static final int C = 3;
public static final int D = 4;
public static final int F = 5;
public static final int INCOMPLETE = 6;
}
˵Ã÷£ºÎÒÒª¸Ðл O'Reilly ýÌ幫˾£¬¸Ã¹«Ë¾ÔÊÐíÔÚ±¾ÎÄÖÐʹÓÃÎÒ׫дµÄ Java 1.5 Tiger:
A Developer's Notebook Ò»ÊéÖГö¾Ù”ÕâÒ»ÕÂÖеĴúÂëʾÀý£¨Çë²ÎÔIJο¼×ÊÁÏ£©¡£
È»ºóÄú¾Í¿ÉÒÔÈÃÀà½ÓÊÜÏñ OldGrade.B ÕâÑùµÄ³£Á¿£¬µ«ÊÇÔÚÕâÑù×öµÄʱºò£¬Çë¼ÇסÕâÀà³£Á¿
ÊÇ Java ÖÐ int ÀàÐ͵ij£Á¿£¬ÕâÒâζן÷½·¨¿ÉÒÔ½ÓÊÜÈκΠint ÀàÐ͵ÄÖµ£¬¼´Ê¹ËüºÍ
OldGrade Öж¨µÄËùÓм¶±ð¶¼²»¶ÔÓ¦¡£Òò´Ë£¬ÄúÐèÒª¼ì²âÉϽçºÍϽ磬ÔÚ³öÏÖÎÞЧֵµÄʱºò£¬¿ÉÄÜ»¹
Òª°üº¬Ò»¸ö IllegalArgumentException¡£¶øÇÒ£¬Èç¹ûºóÀ´ÓÖÌí¼ÓÁíÍâÒ»¸ö¼¶±ð£¨ÀýÈç
OldGrade.WITHDREW_PASSING£©£¬ÄÇô±ØÐë¸Ä±äËùÓдúÂëÖеÄÉϽ磬²ÅÄܽÓÊÜÕâ¸öÐÂÖµ¡£
»»¾ä»°Ëµ£¬ÔÚʹÓÃÕâÀà´øÓÐÕûÐͳ£Á¿µÄÀàʱ£¬¸Ã½â¾ö·½°¸Ò²Ðí¿ÉÐУ¬µ«²¢²»ÊǷdz£ÓÐЧ¡£ÐÒ
Ô˵ÄÊÇ£¬Ã¶¾ÙÌṩÁ˸üºÃµÄ·½·¨¡£
¶¨Òåö¾Ù
Çåµ¥ 2 ʹÓÃÁËÒ»¸ö¿ÉÒÔÌṩÓëÇåµ¥ 1 ÏàËƵŦÄܵÄö¾Ù£º
Çåµ¥ 2. ¼òµ¥µÄö¾ÙÀàÐÍ
package com.oreilly.tiger.ch03;
public enum Grade {
A, B, C, D, F, INCOMPLETE
};
ÔÚÕâÀÎÒʹÓÃÁËеĹؼü×Ö enum£¬Îª enum ÌṩÁËÒ»¸öÃû³Æ£¬²¢Ö¸¶¨ÁËÔÊÐíµÄÖµ¡£È»ºó
£¬Grade ¾Í±ä³ÉÁËÒ»¸öö¾ÙÀàÐÍ£¬Äú¿ÉÒÔ°´Çåµ¥ 3 ËùʾµÄ·½·¨Ê¹ÓÃËü£º
Çåµ¥ 3. ʹÓÃö¾ÙÀàÐÍ
package com.oreilly.tiger.ch03;
public class Student {
private String firstName;
privat
Ïà¹ØÎĵµ£º
Ò»£º×¼±¸ www.savarese.org download
1. rocksaw-1.0.0-src.tar.gz
2. vserv-tcpip-0.9.2-src.tar.gz
¶þ£º±àÒëÔ´ÎļþµÃµ½jar°ü ʹÓÃAnt
1. build vserv-tcpip-0.9.2-src
ÔÚvserv-tcpip-0.9.2Ŀ¼ÏÂÃ潨һ¸ötestsĿ¼£¬È»ºóÔÚcmd´°¿ÚϽøÈë ......
×÷Ϊ¶ÔÏóµÄ´´½¨Ä£Ê½,µ¥Àýģʽȷ±£Ä³¸öÀàÖ»ÓÐÒ»¸öʵÀý£¬¶øÇÒ×ÔÐÐʵÀý»¯²¢ÏòÕû¸öϵͳÌṩÕâ¸öʵÀý¡£Õâ¸öÀà³ÆΪµ¥ÀýÀà¡£Óɶ¨Òå¿ÉÒÔ×ܽá³öµ¥ÀýģʽµÄÒªµãÓÐÈý¸ö£ºÒ»Êǵ¥ÀýÀàÖ»ÄÜÓÐÒ»¸öʵÀý£»¶þÊÇËü±ØÐë×ÔÐд´½¨Õâ¸öʵÀý£»ÈýÊÇËü±ØÐë×ÔÐÐÏòÕû¸öϵͳÌṩÕâ¸öʵÀý¡£
ÔÚ¼ÆËã»úϵͳÖУ¬Ï̳߳ء¢»º´æ¡¢ÈÕÖ ......
java¾µäÊé¼®»ã×Ü£¨²¿·Ö£©
Ò»¡¢ÈëÃÅ
¡¶Java 2´ÓÈëÃŵ½¾«Í¨¡·£ ÍƼö
¡¶Thinking in Java¡·£ Ç¿ÁÒÍƼö*
O’reillyµÄJava±à³Ì»ù´¡ÏµÁÐ £ ²Î¿¼*
¶þ¡¢½ø½×
¡¶Java Cook Book¡·£ ·Ç³£ÍƼö* £¨°üº¬ÁËJava±à³ÌµÄTips£¬Êʺϵ± ......
×÷Îı¾±à¼Æ÷µÄʱºò£¬³·Ïú(undo)¡¢»Ö¸´(redo)ÊDZز»¿ÉÉÙµÄÁ½¸ö¹¦ÄÜ¡£ÊµÏÖÕâ¸ö¹¦ÄÜ£¬ÒªÓõ½javax.swing.undo°üÖеÄUndoManagerÀà¡£
UndoManagerÀàÓÐÈçϳ£Ó÷½·¨£º
boolean canUndo() ——ÅжÏÄÜ·ñ½øÐг·Ïû²Ù×÷£¬¿ÉÒÔÔò·µ»Øtrue¡£
boolean canRedo() ——ÅжÏÄÜ·ñ½øÐлָ´²Ù×÷£¬¿ÉÒÔÔò·µ ......
Java¶¯Ì¬´úÀíÀàλÓÚJava.lang.reflect°üÏ£¬Ò»°ãÖ÷ÒªÉæ¼°µ½ÒÔÏÂÁ½¸öÀࣺ
(1). Interface InvocationHandler£º¸Ã½Ó¿ÚÖнö¶¨ÒåÁËÒ»¸ö·½·¨Object£ºinvoke(Object obj,Method method, Object[] args)¡£ÔÚʵ¼ÊʹÓÃʱ£¬µÚÒ»¸ö²ÎÊýobjÒ»°ãÊÇÖ¸´úÀíÀ࣬methodÊDZ»´úÀíµÄ·½·¨£¬ÈçÉÏÀýÖеÄdothing()£¬argsΪ¸Ã·½·¨µÄ²ÎÊýÊý×é¡£ ......