what are the outputs from print statement respectively, If you give the user inputs below for the following program? inputs # 1: inputChar: i inputString: Wish you have a very happy holiday input #2: inputChar: e inputString: Wish you a merry Christmas import java.util.Scanner; public class LabProgram { } public static void main(String[] args) { Scanner input = new Scanner(System.in); char inputChar; String inputString: int numChars = 0; int i = 0; inputChar=input.next().charAt(0); inputString = input.nextLine(); while (i

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter8: Advanced Method Concepts
Section: Chapter Questions
Problem 8RQ
icon
Related questions
Question

Computer Science

Java Please

what are the outputs from print statement respectively, If you give the user inputs below for the following program?
inputs #1:
inputChar: i
inputString: Wish you have a very happy holiday
input #2:
inputChar: e
inputString: Wish you a merry Christmas
import java.util.Scanner;
public class LabProgram {
}
public static void main(String[] args) {
}
Scanner input = new Scanner(System.in);
char inputChar;
String inputString;
int numChars = 0;
int i = 0;
inputChar = input.next().charAt(0);
inputString = input.nextLine();
while (i <inputString.length()) {
}
if (inputString.charAt(i) == inputChar) {
numChars = numChars + 1;
}
i=i+1;
System.out.println(numChars);
Transcribed Image Text:what are the outputs from print statement respectively, If you give the user inputs below for the following program? inputs #1: inputChar: i inputString: Wish you have a very happy holiday input #2: inputChar: e inputString: Wish you a merry Christmas import java.util.Scanner; public class LabProgram { } public static void main(String[] args) { } Scanner input = new Scanner(System.in); char inputChar; String inputString; int numChars = 0; int i = 0; inputChar = input.next().charAt(0); inputString = input.nextLine(); while (i <inputString.length()) { } if (inputString.charAt(i) == inputChar) { numChars = numChars + 1; } i=i+1; System.out.println(numChars);
Expert Solution
steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
Random Class and its operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,