Here is a little code that I wrote to test (is this called a reflection API?), But while I am not getting the expected results. Here is the code:
public class Outer { public Outer(){ System.out.println("Outer Class"); } public class Inner { public Inner(){ System.out.println("Inner Class"); } } }
Also here is the main function that I wrote to run the code and test it ...
public class ClassTest { public static void main(String[] args) { Outer outObj = new Outer(); Outer.Inner inObj = outObj.new Inner();
The test fails with the following error:
if (objTyp.getClass () == Outer.Inner.class) {^ where CAP # 1 is a new variable of the type: CAP # 1 extends the class from capture? propagates class 1 error
Please help me fix the code. What am I missing? Thanks.
source share