Question: In Java please Given string inputString on one line, character userChar on a second line, and integer strIndex on a third line, output Match found
In Java please
Given string inputString on one line, character userChar on a second line, and integer strIndex on a third line, output "Match found" if the character at index strIndex of inputString matches userChar. Otherwise, output "Match not found". End with a newline. Ex: If the input is: write i 2 then the output is: Match found Note: Assume the length of string inputString is greater than strIndex. \begin{tabular}{r|r} 1 & import java. util. Scanner; \\ 2 & public class MatchingChar \{ \\ 3 & public static void main(String[] args) \{ \\ 4 & Scanner scnr = new Scanner(System.in); \\ 5 & String inputString; \\ 6 & char userChar; \\ 7 & int strIndex; \\ 8 & \\ 9 & inputString = scnr.nextLine(); \\ 10 & userChar = scnr.next().charAt(0); \\ 11 & strIndex = scnr.nextInt(); \\ 12 & \\ 13 & Your code goes here / \end{tabular}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
