Driver code
public static void main ( String [ ] args ) { String exp1 = " ( ( ( ) ) ) ( ) ( ) " ; if ( isBalanced ( exp1 ) ) System . out . println ( " Balanced " ) ; else System . out . println ( " Not ▁ Balanced " ) ; String exp2 = " ( ) ) ( ( ( ) ) " ; if ( isBalanced ( exp2 ) ) System . out . println ( " Balanced " ) ; else System . out . println ( " Not ▁ Balanced " ) ; } }