The Program given below can be used to check whether a given mathematical expression is valid or invalid.The Validation procedure is based on the presence of complementary opening and closing braces.
Check out the full Source Code at
Java Program to Check whether a Expression is Valid using Stack | C ,JAVA and TASM Programming Made Easy with Source Codes and Tutorials