Question: Edit the code so that instead of the example inputs at the bottom, it prompts for a file name from your computer then checks it
Edit the code so that instead of the example inputs at the bottom, it prompts for a file name from your computer then checks it
import java.util.Stack;
public class BalancedBrackets
public static boolean isBalancedString s
Stack stack new Stack;
for char c : stoCharArray
if c c c
stack.pushc;
else
if stackisEmpty
return false;
char top stack.pop;
if c && top c && top c && top
return false;
return stack.isEmpty;
public static void mainString args
System.out.printlnisBalanced;
System.out.printlnisBalanced;
System.out.printlnisBalanced;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
