Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Describe what is happening in the area highlighted in yellow. [NOTE: You need to

ID: 3717773 • Letter: D

Question

Describe what is happening in the area highlighted in yellow. [NOTE: You need to explain why certain methods are being over ridden].

import javax swing.*; public class Console public static String readLine (_ StringBuilder response = new StringBuilder(): Try f BufferedInputStream binnew BufferedInputStream( System.out); int in0 char inChar; Do 1 in = bin . read ( ); inChar-(char) in; response.append(inChar); 1 While ((in! -1) & (inChar!- 'In')); bin,close (); return re s pon s e.tostring) > Catch (IOexception e) System.out .println( "Exception: "e. get Message)) return nul

Explanation / Answer

Program:

import java.io.*;
import javax.swing.*;
import java.util.Scanner;
import java.io.BufferedInputStream;
public class Console {
public static String readLine() {
StringBuilder response = new StringBuilder();
try {
BufferedInputStream bin = new BufferedInputStream(System.in);
int in = 0;
char inChar;
do {
in = bin.read();
inChar = (char) in;
if (in != -1) {
response.append(inChar);
}
} while ((in != -1) & (inChar != ' '));
bin.close();
return response.toString();
} catch (Exception e) {
System.out.println("Exception: " + e.getMessage());
return null;
}
}
public static void main(String args[])
{
Console ob=new Console();
ob.readLine();
}
}