Cast a class in Java
basic casting should be 

> MyClass mc = (MyClass)aClass

 that is easy

but based on my program, I don't know the class name until runtime.

for example, the class name could be interp_0, interp_1, interp_2, interp_3 .......#;


Is there anyway in java that I could use to cast it?

For now All I got is 

> Class afterCast = Class.forName("Interp_" + countState);

but what I want  is 

> ("Interp_" + countState) afterCast

 , not 

> Class afterCast

 .





Cast a class in Java
===

basic casting should be 

> MyClass mc = (MyClass)aClass

 that is easy

but based on my program, I don't know the class name until runtime.

for example, the class name could be interp_0, interp_1, interp_2, interp_3 .......#;


Is there anyway in java that I could use to cast it?

For now All I got is 

> Class afterCast = Class.forName("Interp_" + countState);

but what I want  is 

> ("Interp_" + countState) afterCast

 , not 

> Class afterCast

 .




