I was wondering how can I execute String variable with some java expression, lets say I have created 10 cars object in test class c1-c10 without using array eg.
for(int i = 1; int < 11; i++)
{
String getCarBrand = "car" + i + ".getBrand();"
System.out.println("Car number " + i + "is "+ getCarBrand);
};
I know that I could do it easily with arrays but I want to know if there's a way of executing String as a java expression.
Thanks.