參考類:java.text 類 DateFormatjava.lang.Object java.text.Format java.text.DateFormat所有已實現的介面: Serializable, Cloneable 直接已知子類: SimpleDateFormat 構造方法摘要protected DateFormat() 建立一個新的 DateFormat。字母 日期或時間元素 表示 樣本 G Era 標誌符 Text AD y 年 Year 199
執行個體如下:package com;/*** * * 鳥類 * * @author Administrator * */public class Bird implements Animal { public Bird() { } public String color; private int age; public int getAge() { return age; } public void setAge(int a
import java.util.*;import java.text.*;import java.lang.*;import sun.io.*;public class DealString{public long makeID ( int uid ){ //使用者佔5位 uid += 10000 ; //時間佔9位:秒,去掉第一位 java.util.Date time = new java.util.Date(); long second =
1、Servlet中可以使用javax.servlet.ServletContext的getResourceAsStream()方法樣本:InputStream in = context.getResourceAsStream(path);Properties p = new Properties();p.load(in); 2、使用java.util.Properties類的load()方法樣本: InputStream in = lnew BufferedInputStream(new
hash表是快速尋找演算法中比較好的一種,雜湊表中的雜湊函數是其中比較重要的。Java使用的Hash函數說明如下 /** * Returns a hash code for this string. The hash code for a * <code>String</code> object is computed as * <blockquote><pre> * s[0]*31^(n-1) + s[1]*31
Java exception and throw and try catch:package com;class A extends Exception...{ }class B extends A ...{ }public class Test ...{ public static void main(String[] args) ...{ try ...{ throw new A(); } catch (A e) ...{
1 Java有那些基礎資料型別 (Elementary Data Type),String是不是基礎資料型別 (Elementary Data Type),他們有何區別。 六種數字類型(四個整數型,兩個浮點型),一種字元類型,還有一種布爾型。主要注意每個類型的取值範圍。防止程式溢出該類型的範圍。String是類,不是基礎資料型別 (Elementary Data