This is kind of complicated, but I need to have my program to be able to detect, which class to reference based on the data of an array.
I know how to do this by using a huge if statement, but that would be a HUGE amount of code. Is there a way to like put the variable so that it would be like
String x; x new = new x();
if you get the idea. x would hold the class name. Or is there another way to do this? Thanks.
Object x = CreateInstanceOfSomeTypeDynamically(str)or similar. Note that this results in 1) a fixed variable name (x) and 2) not a very useful type refinement on said variable (an interface of supertype could unify a bit, but it feels like an XY problem).