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

javaµÚ7Ìì´úÂë (javaÒì³£)

/*****************TestCar1  begin************************/
public class TestCar1 {
 
 public static final int Ok=1;     //Õý³£Çé¿ö
 public static final int Wrong=2;  //Òì³£Çé¿ö
 
 public int run(){
  if("³µ×ÓûÓгöÏÖ¹ÊÕÏ"){            //Õý³£Á÷³Ì
   return Ok;               
  }else {                       //Òì³£Á÷³Ì
   return Wrong;
  }
 }
}
class Worker{
 private TestCar1 car;
 
 public static final int int_time=1;     //Õý³£Çé¿ö,׼ʱµ½´ïµØµã
 public static final int late=2;         //Òì³£Çé¿ö,ÉÏ°à³Ùµ½
 
 public Worker(){}
 
 /** ¿ª³µÈ¥ÉÏ°à */
 public int gotoWork(){
  if(car.run()==TestCar1.Ok){
   return int_time;
  }else{
   walk();
   return late;
  }
 }
 /** ²½ÐÐÈ¥ÉÏ°à */
 public void walk(){}
}
/*****************TestCar1  end************************/
/*****************TestCar2  begin************************/
import java.util.Date;
public class TestCar2 {
}
/** ±íʾ³µ×Ó³öÏÖ¹ÊÕÏÇé¿öÀà  */
class CarWrongException extends Exception{
 public CarWrongException(){}
 
 public CarWrongException(String message){
  super(message);
 }
}
/** ±íʾÉÏ°à³Ùµ½Çé¿öÀà  */
class LateException extends Exception{
 
 private Date arriveTime;    //³Ùµ½µÄʱ¼ä
 private String reason;      //³Ùµ½µÄÔ­Òò
 
 public Date getArriveTime() {
  return arriveTime;
 }
&


Ïà¹ØÎĵµ£º

¹¦ÄÜÍêÉƵÄJavaÁ¬½Ó³Øµ÷ÓÃʵÀý


/**
* Title: ConnectPool.java
* Description: Á¬½Ó³Ø¹ÜÀíÆ÷
* Copyright: Copyright (c) 2002/12/25
* Company:
* Author :
* Version 2.0
*/
import java.io.*;
import java.sql.*;
import java.util.*;
import java.util.Date;
/**
* ¹ÜÀíÀàDBConnectionManagerÖ§³Ö¶ÔÒ»¸ö»ò¶à¸öÓÉÊôÐÔÎļ ......

Java ÀíÂÛºÍʵ¼ù:·ºÐÍ11ÔÂ06ÈÕ[תÌù]

     Java ÀíÂÛºÍʵ¼ù: Á˽ⷺÐÍ Ê¶±ðºÍ±ÜÃâѧϰʹÓ÷ºÐ͹ý³ÌÖеÄÏÝÚå
 
      JDK 5.0 ÖÐÔö¼ÓµÄ·ºÐÍÀàÐÍ£¬ÊÇ Java ÓïÑÔÖÐÀàÐÍ°²È«µÄÒ»´ÎÖØÒª¸Ä½ø¡£µ«ÊÇ£¬¶ÔÓÚ³õ´ÎʹÓ÷ºÐÍÀàÐ͵ÄÓû§À´Ëµ£¬·ºÐ͵ÄijЩ·½Ãæ¿´ÆðÀ´¿ÉÄܲ»ÈÝÒ×Ã÷°×£¬ÉõÖÁ·Ç³£Ææ¹Ö¡£ÔÚ±¾ÔµÄ"Java Àí ......

java·½·¨µÄÖØÔØÓ븲¸Ç

java¶à̬µÄ2ÖÖ±íÏÖÐÎʽ ·½·¨ÖØÔغͷ½·¨¸²¸Ç
·½·¨ÖØÔØ£ºÍ¬Ò»¸öÀàÖУ¬·½·¨ÃûÏàͬ£¬²ÎÊýÁÐ±í²»Í¬µÄ2¸ö»ò¶à¸ö·½·¨¹¹³É·½·¨µÄÖØÔØ¡£
·½·¨¸²¸Ç£º×ÓÀàÖØÐÂʵÏÖÁ˸¸ÀàÖеķ½·¨¡£
·½·¨ÖØÔØ
/**
* ·½·¨ÖØÔØÂú×ãµÄÌõ¼þ
* ͬһ¸öÀàÖУ¬·½·¨ÃûÏàͬ£¬²ÎÊýÁÐ±í²»Í¬µÄ2¸ö»ò¶à¸ö·½·¨¹¹³É·½·¨µÄÖØÔØ
* ²ÎÊýÁÐ±í²»Í¬Ö¸²ÎÊýµÄÀàÐÍ£¬²Î ......

javaºËÐĽ̳̱ʼÇ

1.privateÐÞÊη½·¨²»Äܱ»ÍⲿÀàµ÷Óá£
2.finalÐÞÊεĶÔÏó¹¹½¨ºó²»Äܱ»Ð޸ġ£
À©Õ¹:
finalÀ಻Äܱ»¼Ì³Ð£¬Ã»ÓÐ×ÓÀ࣬finalÀàÖеķ½·¨Ä¬ÈÏÊÇfinal¡£
final²»Äܱ»×ÓÀàµÄ·½·¨¸²¸Ç£¬µ«¿ÉÒÔ±»¼Ì³Ð¡£
final³ÉÔ±±äÁ¿±íʾ³£Á¿£¬Ö»Äܱ»¸³ÖµÒ»´Î£¬¸³ÖµºóÖµ²»Ôٸı䡣
final²»ÄÜÓÃÓÚÐÞÊι¹Ôì·½·¨¡£
finalº¯Êý²ÎÊýÎÞ·¨±»¸Ä±ä¡£
¸¸ ......

javaºËÐĽ̳̱ʼÇ

1.½Ó¿ÚÓë³éÏóÀàÇø±ð
      abstract class ÔÚ Java ÓïÑÔÖбíʾµÄÊÇÒ»Öּ̳йØϵ£¬Ò»¸öÀàÖ»ÄÜʹÓÃÒ»´Î¼Ì³Ð¹Øϵ¡£µ«ÊÇ£¬Ò»¸öÀàÈ´¿ÉÒÔʵÏÖ¶à¸öinterface¡£
¡¡¡¡ÔÚabstract class ÖпÉÒÔÓÐ×Ô¼ºµÄÊý¾Ý³ÉÔ±£¬Ò²¿ÉÒÔÓзÇabstarctµÄ³ÉÔ±·½·¨£¬¶øÔÚinterfaceÖУ¬Ö»Äܹ»Óо²Ì¬µÄ²»Äܱ»Ð޸ĵÄÊý¾Ý³ÉÔ± ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ