Java對properties設定檔的操作/* * Created on 2005-1-4 * * TODO To change the template for this generated file go to * Window - Preferences - Java - Code Style - Code Templates */package com.yorsun;import java.io.File;import java.io.FileInputStream;import
附:關於yield與sleepsleep() will let your threaddo nothing for a certain amount of time. Basically, your thread can’t do anything until it is done sleeping. yield() will cause your thread to voluntarily let other threads in your program run. If no
Servlet的一些技巧&模板代碼Request相關獲得一些基本參數//擷取提交地址request.getRequestURI();//擷取提交內容request.getQueryString();//擷取用戶端地址(瀏覽器)request.getRemoteAddr();//擷取用戶端連接埠(瀏覽器)request.getRemotePort();//擷取提交方法(GET,POST or
AOP,《thinking in java 4th》中沒有過多闡述,只能結合視頻和尋找其他資料了。AOP的大概原理是這樣的:設計模式高深了,咱連皮毛都觸不到,目前知道這個就行了。下面是談不上設計模式的建議代碼實踐: 1 import java.lang.reflect.InvocationHandler; 2 import java.lang.reflect.Method; 3 import java.lang.reflect.Proxy; 4 5 public class Test { 6
內省是 Java 語言對 Bean 類屬性、事件的一種處理方法(也就是說給定一個javabean對象,我們就可以得到/調用它的所有的get/set方法)。例如類 A 中有屬性 name, 那我們可以通過 getName,setName 來得到其值或者設定新的值。通過 getName/setName 來訪問 name 屬性,這就是預設的規則。Java 中提供了一套 API 用來訪問某個屬性的 getter/setter 方法,通過這些 API 可以使你不需要瞭解這個規則,這些 API 存放於包