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

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;
¡¡private String lastName;
¡¡private Grade grade;
¡¡public Student(Stri


Ïà¹ØÎĵµ£º

java reflect »úÖÆ

JAVAÓïÑÔÖеķ´Éä»úÖÆ£º
    ÔÚJava ÔËÐÐʱ »·¾³ÖУ¬¶ÔÓÚÈÎÒâÒ»¸öÀ࣬ÄÜ·ñÖªµÀÕâ¸öÀàÓÐÄÄЩÊôÐԺͷ½·¨£¿
    ¶ÔÓÚÈÎÒâÒ»¸ö¶ÔÏó£¬ÄÜ·ñµ÷ÓÃËûµÄ·½·¨£¿ÕâЩ´ð°¸Êǿ϶¨µÄ£¬ÕâÖÖ¶¯Ì¬»ñÈ¡ÀàµÄÐÅÏ¢£¬ÒÔ¼°¶¯Ì¬µ÷ÓÃÀàµÄ·½·¨µÄ¹¦ÄÜÀ´Ô´ÓÚJAVAµÄ·´Éä¡£´Ó¶øʹjava¾ßÓж¯Ì¬ÓïÑÔµÄÌØÐÔ¡£
  JA ......

javaµÚ9Ìì´úÂ루¼¯ºÏÀࣩ

/**********Customer .java   begin***********/
import java.util.HashSet;
import java.util.Set;
/**
 * Èç¹ûÁ½¸öCustomer¶ÔÏónamaÊôÐÔºÍageÊôÐÔÏàͬ£¬ÄÇôÕâÁ½¸öCustomer¶ÔÏóÏàµÈ¡£
 * @author Administrator
 *
 */
public class Customer {
 
 private String nam ......

javaÔËÐÐÓ¦ÓóÌÐò

ÔËÐÐÓ¦ÓóÌÐòÓëÔËÐÐweb³ÌÐòÔ­ÀíÊÇÒ»Öµģ¬Ö»²»¹ýwebÓ¦ÓóÌÐòÒѾ­ÔÚÆô¶¯Ê±½«³ÌÐòÔËÓõÄjar°üÉèÖõ½»·¾³±äÁ¿ÀӦÓóÌÐò¿ÉÒÔ×Ô¼ºÐ´¸öÅú´¦ÀíÀ´ÉèÖû·¾³±äÁ¿£º
java -classpath ./lib/application.jar;./lib/hibernate3.jar -Xms608m -Xmx608m com.zyj.application.StartUp
pause/exit
ÆäÖÐapplication.jarΪӦÓóÌÐòµÄjar° ......

java±Ê¼Ç

½ñÌìÖØÐÂÕûÀíµçÄÔ£¬ÕÒµ½Ò»¸öÎļþ£¬¿´ÁËÏÂÈÕÆÚ£¨2006.11.3£© £¬Å²»Ð¡ÐÄÔÙ¶ªÁË£¬´æµ½ÍøÉÏÀ´É¹É¹¡£
 ¹Ø¼ü×ÖÓֳƱ£Áô×Ö£¬ÊÇ Java ÓïÑԹ涨ÁËÌض¨º¬ÒåµÄ±êʶ·û¡£Óû§Ö»ÄÜ°´ÕÕϵͳ¹æ¶¨µÄ·½Ê½Ê¹Ó㬲»ÄÜ×ÔÐж¨Òå¡£¹Ø¼ü×ÖÒ»ÂÉÓÃСд×Öĸ±íʾ¡£Java ÖеĹؼü×ÖÓÐ 50 ¸ö£¬°´ÓÃ;»®·ÖΪ£ºÊý¾ÝÀàÐÍ¡¢Óï¾ä¡¢ÐÞÊΡ¢·½·¨¡¢Àà¡¢ ......

Java: class , objects

Java: class , objects
1 Inheritance(¼Ì³Ð)µÄ¹Ø¼ü×Öextends
class MountainBike extends Bicycle {
}
µ«ÊDz»ÄܶàÖؼ̳С£²»¹ý¿ÉÒÔͨ¹ýimplements¶à¸öinterfaceÀ´ÊµÏÖÀàËƵĶ«Î÷
2 interface
interface Bicycle {
       void changeCadence(int newValue);   // wheel rev ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ