I have the following Java code:
int i = 6;
int j = 2;
String[] operators = {"+", "-", "*", "\\"};
for(String operator : operators) {
System.out.print(Integer.valueOf(i + operator + j));
}
But I get:
Exception in thread "main" java.lang.NumberFormatException: For input string: "6+2"
How to solve this? The result should be:
8
4
12
3
Thanks!