Can you pinpoint what is wrong with this codeplease explain
Can you pinpoint what is wrong with this code?please explain thank you.
import java.util.Scanner;
public class InputOutput
public static void main(String[]args){
System.out.println(\"Print first \");
System.out.println(\"Print second \");
System.out.println(\"Print third\");
System.out.println(\"Print fourth\");
System.out.println(\"Print fifth\");
Scanner input = new Scanner(System.in);
System.out.println(\"What is your favorite color? \");
String color = input.nextLine();
System.out.println(\"You wrote: \" + “color”);
System.out.println(\"How many apples do you have? \");
numApples = scnr.nextInt();
System.out.println(\"You wrote: \" + numApples);
return;
}
}
Solution
public class RangeFilter { public static void main(String[] args) { // read in two command-line arguments int lo = Integer.parseInt(args[0]); int hi = Integer.parseInt(args[1]); // repeat as long as there\'s more input to read in while (!StdIn.isEmpty()) { // read in the next integer int t = StdIn.readInt(); // print out the given integer if it\'s between lo and hi if (t >= lo && t <= hi) { StdOut.print(t + \" \"); } } StdOut.println(); } }![Can you pinpoint what is wrong with this code?please explain thank you. import java.util.Scanner; public class InputOutput public static void main(String[]args) Can you pinpoint what is wrong with this code?please explain thank you. import java.util.Scanner; public class InputOutput public static void main(String[]args)](/WebImages/43/can-you-pinpoint-what-is-wrong-with-this-codeplease-explain-1132712-1761605494-0.webp)