Question: In JAVA Please Help. I asked this already but somebody answered in python. My code in JAVA is outputting in red as shown on the
In JAVA Please Help. I asked this already but somebody answered in python. My code in JAVA is outputting in red as shown on the left hand side but I need help to output my code where it shows on the right. My CODE import java.io;
import java.util.;
public class SortCars
public static void mainString args
Scanner scanner new ScannerSystemin;
System.out.printlnWhat car make are you looking for?";
String carMake scanner.nextLinetrim;
List cars new ArrayList;
try BufferedReader br new BufferedReadernew FileReadercarstxt
String line;
while line brreadLine null
if linestartsWithcarMake
cars.addline;
catch IOException e
System.out.printlnError reading file: egetMessage;
return;
Collections.sortcars;
if carsisEmpty
System.out.printlnNo cars found for the make: carMake;
else
for String car : cars
System.out.printlncar;
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
