Agile Java ѧϰ±Ê¼Ç£¨¶þ£© Æð²½
ÓÉÓÚÓÐÒ»¶¨µÄJavaºÍJUnitµÄ»ù´¡£¬ËùÒԸоõµÚÒ»¿Î±È½Ï¼òµ¥£¬µ«ÊÕ»ñ»¹ÊÇÓе쬱ÈÈçËµÖØ¹¹²¿·Ö½éÉܵÄÄÚÈÝ¡£
JUnitÒªµã£º
²âÊÔ·½·¨µÄÃüÃû¹æÔò£º
l ·½·¨±ØÐëÉùÃ÷Ϊpublic
l ·½·¨µÄ·µ»ØÖµ±ØÐëΪvoid
l ·½·¨µÄÃû×Ö±ØÐëÒÔСдµÄtestΪǰ׺
l ·½·¨²»ÄܽÓÊÜÈκβÎÊý
ÖØ¹¹Òªµã£º
1. ±£Ö¤ÔÚϵͳÖÐûÓÐÖØ¸´µÄ´úÂë
2. ±£Ö¤´úÂëÊǸɾ»µÄ£¬²¢ÇÒ¸»ÓбíÏÖÁ¦£¬¿ÉÒÔÇåÎúµØÌåÏÖ³ÌÐòÔ±µÄÒâͼ
ÖØ¹¹²¿·ÖÖ÷Òª½²ÁËÁ½µã£º1. Çå³ý²»±ØÒªµÄ±äÁ¿¡£ 2. ²»ÄÜÓÐÖØ¸´´úÂë¡£
±ÈÈç˵³öÏÖ¶à´ÎµÄÒ»¸ö×Ö·û´®¿ÉÒÔÓÃÒ»¸öfinalµÄ¾Ö²¿±äÁ¿À´Ìæ´ú¡£
ÁíÍ⣬ÏÈд²âÊÔ¡£
Ïà¹ØÎĵµ£º
toString() ·½·¨£º
toString()·½·¨ÔÚObjectÀàÖж¨Ò壬Æä·µ»ØÖµÊÇStringÀàÐÍ£¬ÃèÊöµ±Ç°¶ÔÏóµÄÓйØÐÅÏ¢
ÔÚ½øÐÐStringÓëÆäËüÀàÐÍÊý¾ÝµÄÁ¬½Ó²Ù×÷ʱ£¬×Ô¶¯µ÷ÓÃtoString()·½·¨
¿ÉÒÔ¸ù¾ÝÐèÒªÔÚÓû§×Ô¶¨ÒåÀàÐÍÖÐÖØÐ´toString()·½·¨
»ù±¾ÀàÐÍÊý¾Ý× ......
µÚÒ»´Î³¢ÊÔдѧϰ±Ê¼Ç£¬ÒòΪ¾õµÃÒÔǰѧ¹ýµÄ¶«Î÷³¤Ê±¼ä²»ÓþͶ¼ÍüÁË¡£Ò²²»ÖªµÀÕâÑù×öÖµ²»ÖµµÃ£¬ÒòΪ±Ï¾¹Ð´Ñ§Ï°±Ê¼Ç»á»¨·ÑÒ»¶¨µÄʱ¼ä£¬¶ÔÓÚÒ»¸öÈí¼þ¹¤³ÌרҵµÄ´óÈýѧÉúÀ´Ëµ£¬¿Î³Ì·±ÖØÊÇÖÚËùÖÜÖªµÄ¡£¶øÇÒÎÒµÄÎıÊÓÖ²»ºÃ£¬Ê±³£Ð´×ÅдמͲ»ÖªµÀ¸ÃÕâôдÁË£¬ÊôÓÚÄÇÖÖÐÄÖª¶ÇÃ÷¾ÍÊÇ˵²»³öÀ´µÄÀàÐÍ¡£²»¹ý£ ......
¹Ø¼ü×Öfinal£º
ÔÚJavaÖÐÉùÃ÷Àà¡¢ÊôÐԺͷ½·¨Ê±£¬¿ÉʹÓùؼü×ÖfinalÀ´ÐÞÊΡ£
final±ê¼ÇµÄÀ಻Äܱ»¼Ì³Ð¡£
final±ê¼ÇµÄ·½·¨²»Äܱ»×ÓÀàÖØÐ´¡£
final±ê¼ÇµÄ±äÁ¿(³ÉÔ±±äÁ¿»ò¾Ö²¿±äÁ¿)¼´³ÉΪ³£Á¿£¬Ö»Äܸ³ÖµÒ»´Î¡£
final±ê¼Çµ ......
JavaÈÕ»ýÔÂÀÛ-1£ºJavaÖÐbooleanÀàÐ͵ÄλÔËËã
1. Ê×ÏȻعËÒ»ÏÂjavaÖеÄ8Öлù±¾ÀàÐͼ°Æä´æ´¢ËùÕ¼ÓõÄbitÊý¡£
ÀàÐÍ
bitÊý
byte
8
short
16
int
32
float
32
long
64
double
64
char
16
boolean
1
2. ÔٻعËÒ»ÏÂjavaµÄÔËËã·ûºÍÓÅÏȼ ......
Compiling with the Java Compiler API
µ÷ÓÃJava±àÒëÆ÷API±àÒëJava
´ÓµÚÒ»Ì쿪ʼ,±ê×¼Javaƽ̨¾ÍȱÉÙÄܹ»±»µ÷ÓÃ,È¥²úÉúJava×Ö½ÚÂëµÄ±àÒëÆ÷½Ó¿Ú. ʹÓÃSunʵÏֵį½Ì¨,Ò»¸öÓû§¿ÉÒÔͨ¹ý·Ç±ê×¼µÄ com.sun.tools.javac °üÖеÄMain class È¥±àÒëÄãµÄ´úÂë (Äã¿ÉÒÔÔÚlib×ÓĿ¼Ï嵀 tools.jar ÎļþÀïÕÒµ½Ëü). È»¶øÕâ¸ö° ......