Question: Java CHALLENGE ACTIVITY 4.13.2: Looking for characters. Write an expression to detect that the first character of userinput matches firstLetter. test 4 1 import java.util.Scanner;
Java 
CHALLENGE ACTIVITY 4.13.2: Looking for characters. Write an expression to detect that the first character of userinput matches firstLetter. test 4 1 import java.util.Scanner; 2 3 public class CharMatching { public static void main(String [] args) { 5 Scanner sehr = new Scanner(System.in); 6 String user Input; 7 char firstLetter; 8 9 user Input = scnr.nextLine(); 18 firstLetter = schr.nextLine().charAt(); 11 12 if (user Input.equals(firstLetter)) { 13 System.out.println("Found match: " + firstLetter); 14 } 15 else { 16 System.out.println("No match: " + firstLetter); 17 } 18 19 return; 20 } 21 ) Run X Testing: "banana', 'b' Output differs. See highlights below. Your output No match: b Expected output Found match: b Testing: "abacus", 'c Your output No match: C X Testing: "1, 2, Buckle my shoe.", '' Output differs. See highlights below. Your output No match: 1 Expected output Found match: 1 Feedback
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
