Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

JAVA-Write a program that checks for the following balancing symbols: /* and */ ( and ) [ and ] { and } Your program should

JAVA-Write a program that checks for the following balancing symbols:

/* and */

( and )

[ and ]

{ and }

Your program should take a Java file as input named input1.java. The output can be either "matching" or "mismatching".

The input file, input1.java is below:

/////////////////////////////

public class Input1 {

public static void main(String[] args) {

try {

Scanner fileIn = new Scanner(new File("infile.txt"));

PrintWriter fileOut = new PrintWriter("out1.txt");

String line;

while (fileIn.hasNextLine()) {

line = fileIn.nextLine();

fileOut.println(line);

System.out.println(line);

}

fileIn.close();

fileOut.close();

catch (IOException ex) { System.out.println("Exception" + ex); }

}

}

//////////////////////////////////////////////

Be sure the code compiles and please include a screenshot of the output

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions