I may have misinterpreted, but I suspect the OP wants to enter a math expression and have the Java do the computes.
My Java skills are a bit lower than zero, but with a little help from Google, NetBeans, and a little luck, I came up with this:
import java.io.*;
import javax.script.ScriptEngineManager;
import javax.script.ScriptEngine;
public class JavaApplication66 {
public static void main (String[] args) throws Exception {
String strExp = null;
String strQuit = "quit";
while (true) {
System.out.print("Enter expression: ");
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
try {
strExp = br.readLine();
if (strExp.equals(strQuit)) {
System.exit(0);
}
ScriptEngineManager mgr = new ScriptEngineManager();
ScriptEngine engine = mgr.getEngineByName("JavaScript");
System.out.println(engine.eval(strExp));
}
catch (IOException e) {
System.out.println("Error!");
System.exit(1);
}
}
}
}
This will handle the arithmetic stuff, but other things like exponents and such probably require something more sophisticated. Program runs in an infinite loop...Enter
quit to exit program.
Good luck.