http://daimojingdeyu.blogbus.com/logs/5185456.html在類中定義了一個屬性abc,如何擷取這個變數的abc的名字串呢?也就是說怎麼知道abc這個變數的名字是abc,這個問題比較的好玩。這個是偶在一開發中遇到的一個比較有趣的問題,找 了半天的資料加下偶辛勤的思考,終於找到的解決方案。用反射~~~java提供了很強大的反射機制,可以說比動態語言還動態。但是這個東東平時的應用不是很多的說。現提供一個可以動態擷取對象中的變數的變數名稱的方法: public
java.sql.SQLException: Unknown type '246 in column 0 of 1 in binary-encoded result set這個異常容易出現在對Bigint欄位的操作上。使用的mysql-connector-java-3.1.7-bin.jar,是屬於mysql的一個bug。解決辦法:使用mysql-connector-java-3.0.17-bin.jar就沒有問題了,而且目前好象只有這個版本無此bug。另外:在mysql-connector-
package blog.csdn.net.arui;import java.io.*;import javax.xml.transform.*;import javax.xml.transform.stream.*;public class BasicXsl ...{ /** *//** * This method applies the xsl file to in file, and writes the output to out * file. *
Java中區分參考型別和原始類型下表列出了原始類型以及它們的對象封裝類。原始類型和封裝類 原始類型封裝類booleanBooleancharCharacterbyteByteshortShortintIntegerlongLongfloatFloatdoubleDouble參考型別和原始類型的行為完全不同,並且它們具有不同的語義。例如,假定一個方法中有兩個局部變數,一個變數為 int 原始類型,另一個變數是對一個 Integer 對象的對象引用:int i = 5;
Java Questions & Answers1. What is the difference between an Applet and an Application?A Java application is made up of a main() method declared as public static void that accepts a string array argument, along with any other classes that