1. new java.util.Date()2. Calendar c = Calendar.getInstance(); c.setTime(new java.util.Date()); int year = c.get(Calendar.YEAR); int month = c.get(Calendar.MONTH)+1; int day =
java.sql.Date 在jdbc使用時會用到,但是問題是只儲存日期資料不儲存時間資料。會丟失時間資料:preparedStatement.setDate(1, new java.sql.Date(date.getTime()));解決的方法是:preparedStatement.setTimestamp(1, new java.sql.Timestamp(new
原文:https://github.com/yusuke/twitter4j/blob/master/twitter4j-examples/src/main/java/twitter4j/examples/tweets/UpdateStatus.java/* * Copyright 2007 Yusuke Yamamoto * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use
JDK的源碼,看看到Integer.ValueOf(int)裡面做了什麼最佳化: public static Integer valueOf(int i) { final int offset = 128; if (i >= -128 && i <= 127) { // must cache return IntegerCache.cache[i + offset]; } return new Integer(i);} private static
1.出現java.lang.ClassNotFoundException: com.microsoft.jdbc.sqlserver.SQLServerDriver 這個錯誤:最後的原因可能如下:1.未安裝SQL Server 2000 Driver for JDBC2.安裝後還注意你程式中類所在包是否匯入了 SQL Server 2000 Driver for JDBC程式安裝後lib檔案下的三個檔案:c:/program files/Microsoft SQL Server 2000