How to evaluate 1+2*3+4/2-2 arthematic expression by taking input as a string using operator priority
Google: "parsing arithmetic expressions"
Firstly you would need to split the string into meaningful lexems (numbers, signs). This could be done in more than one way. However it is not complex problem.
Secondly you need to process them, applying arithmetic rules. You would find that priority is often managed via recursion according to backus-naur rules for your case, or via translating to Reverse Polish Notation and then simply evaluating it.
P.S. Why, by the way, have you chosen such obscure title for your question?
Your use of this web site or any of its content or software indicates your agreement to be bound by these Terms of Participation.
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.