Java入門–Class.forName()の使い方

サンプルコード:
public class ReflectDemoClass {

public ReflectDemoClass() {
System.out.println(“>>ReflectDemoClass() construct>>");
}
static {
System.out.println(“***ReflectDemoClass static operation***");
}

public static void main(String[] args) {
try {
Class.forName(“kaku.DateDemoClassObj");
} catch (ClassNotFoundException e) {

e.printStackTrace();
}
}
}

実行結果
***ReflectDemoClass static operation***

Java

Posted by arkgame