Detecting type of operator stored as string in java [duplicate]
问题 This question already has answers here : Is it possible to pass arithmetic operators to a method in java? (8 answers) Closed 3 years ago . In a Java program, I have these strings: a= 8,7,"+" b=1,5,"*" Each line is a separate process. I want in each line, that two number calculated with that operator. But I don't want to use any type of condition system for detecting which operator is in each line. In fact, my main problem is detecting the type of the operator without conditions. I don't want