Instantiate nested static class using Class.forName

Nested classes use “$” as the separator:

Class.forName("a.b.TopClass$InnerClass");

That way the JRE can use dots to determine packages, without worrying about nested classes. You’ll spot this if you look at the generated class file, which will be TopClass$InnerClass.class.

(EDIT: Apologies for the original inaccuracy. Head was stuck in .NET land until I thought about the filenames…)

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)