I am trying to compile a reflection example with the help of a sample taken from book in Eclipse IDE:
public class Reflection_Test {
public static void main(String[] args) {
// In both cases below, "ClassNotFoundException" occurs
Class c1 = Class.forName("java.util.Date");
Class c2 = Class.forName("Foo");
}
}
class Foo {
// ...
}
I copied the line exactly but this is raising two exceptions. I googled other questions and they suggested to use a correct package name. But in my case I am compiling it under default package. What is it missing?
Aucun commentaire:
Enregistrer un commentaire