
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
The solution to a java code execution problem where the input values from the user are given and the task is to determine the stored values in the variables. The code segment involves using a scanner object to read user input and assign values to variables n1, n2, and n3, which are initially declared as integers, and a string variable s1. The user input is given as 28 33 44 112 1798 245 5.
Typology: Quizzes
1 / 1
This page cannot be seen from the preview
Don't miss anything!

int n1, n2, n3; String s1; Scanner keyboard = new Scanner(System.in);
n3 = keyboard.nextInt(); s1 = keyboard.nextLine(); n2 = keyboard.nextInt(); n1 = keyboard.nextInt(); n3 = keyboard.nextInt();
Suppose also that the following input is typed in at the keyboard:
What will be the values stored in the variables if the code segment is executed using the given keyboard input? Where you see whitespace on a line, assume it is exactly one space.