This week's book giveaway is in the JavaScript forum. We're giving away four copies of Getting MEAN with Mongo, Express, Angular, and Node and have Simon Holmes on-line! See this thread for details.

I am using Stack class to calculate simple arithmetic expressions involving integers, such as 1+2*3.your program would execute operations in the order given,without regarding to the precedence of operators. *Thus, the expression 1+2*3 should be calculated (1+2)*3=9,not 1+(2*3)=7.

If i get the input as 1+2*3,i know how to convert the string 1,2,3 to Integer.but i don't know how to covert +,* from string type to operator.

StringTokenizer st = new StringTokenizer(str,":"); int noOfColumns = st.countTokens(); dbcolumn = new String[noOfColumns]; //System.out.println("Column"+dbcolumn); while (st.hasMoreElements()) { dbcolumn [i++] = st.nextToken(); } int s=0; for(i=0;i<dbcolumn.length;i++){ System.out.println(dbcolumn[i]) ;

} while(i>dbcolumn.length){ s=Integer.parseInt( dbcolumn[i]); dbcolumn[i++].charAt(1) ; int s1=Integer.parseInt(dbcolumn[i+2]);

"Operators" aren't a Java data type; there's no way to convert a String to an operator. What you would do instead is write code that does a certain operation based on the contents of a String; i.e., one simple way might something like