Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Given string inputStr on one line, character userChar on a second line, and integer strIndex on a third line, output Match found if the character

Given string inputStr 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 inputStr matches userChar. Otherwise, output "Match not found". End with a newline.
Ex: If the input is:
threw
t
0
then the output is:
Match found
Note: Assume the length of string inputStr is greater than strindex.
import java.util.Scanner;
public class Matchchar {
public static void main(string[] args){
Scanner scnr= new Scanner(System. in);
string inputstr;
char userchar;
int strIndex;
inputstr =scnr.nextLine()
userchar =scnr* next ()*charAt();
ctrindex =5cnr* nextInt ();
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intelligent Databases Technologies And Applications

Authors: Zongmin Ma

1st Edition

1599041219, 978-1599041216

More Books

Students also viewed these Databases questions