Instructions // Makes String comparisons The files provided in the code editor to the right contain syntax and/or logic errors. In each case, determine and fix 4{{ the problem, remove all syntax and coding errors, and run 5 public static void main(String[] args) the program to ensure it works properly. Scanner kb= new Scanner(System.in); An example of the program is shown below: String name1, name2, name3; System.out.println("Enter three names."); System.out.println("They can be the same or different."); System.out.print("First name >> "); name1 =kb nextLine; System.out.print("Second name >> "); name2 =kb nextLine; System.out.print("Third name >> "); name3 = kb.nextLine; compareNames (name1, name2); compareNames (name1, name3); compareNames (name2, name3); \} public static void comparNames (String n1,n2 ) \{ System.out.print (n1+" and "+n2); if (n1.equals (n2) System.out.println(" are the same"); else System.out.println(" are different"); \}.
Instructions // Makes String comparisons The files provided in the code editor to the right contain syntax and/or logic errors. In each case, determine and fix 4{{ the problem, remove all syntax and coding errors, and run 5 public static void main(String[] args) the program to ensure it works properly. Scanner kb= new Scanner(System.in); An example of the program is shown below: String name1, name2, name3; System.out.println("Enter three names."); System.out.println("They can be the same or different."); System.out.print("First name >> "); name1 =kb nextLine; System.out.print("Second name >> "); name2 =kb nextLine; System.out.print("Third name >> "); name3 = kb.nextLine; compareNames (name1, name2); compareNames (name1, name3); compareNames (name2, name3); \} public static void comparNames (String n1,n2 ) \{ System.out.print (n1+" and "+n2); if (n1.equals (n2) System.out.println(" are the same"); else System.out.println(" are different"); \}.