I want run different classes based on a variable value .. but when I chose the first value it run all classes .. and when I chose second value it runs two last classes and when I chose thirth value it run the last class ..where is the problem in my code ..thanks
String[] args = null;
String y = ps.getSelectedtype() ;
String[] keys = {"Type1", "Type2", "Type3"};
String[] values = {"conditionA", "conditionB", "conditionC"};
String match = "default";
for (int i = 0; i < keys.length; i++) {
if (y.contains(keys[i])) {
match = values[i];
break;
}
}
switch (match) {
case "conditionA":
FirstClass.main(args);
case "conditionB":
SecondClass.main(args);
case "conditionC":
ThirthClass.main(args);
}