Question: import java.util.Scanner; public class ScannerDemo 2 { public static void main ( String [ ] args ) { int n 1 , n 2 ;

import java.util.Scanner;
public class ScannerDemo2
{
public static void main(String[] args)
{
int n1, n2;
Scanner scannerObject = new Scanner(System.in);
System.out.println("Enter two whole numbers");
System.out.println("seperated by one or more spaces:");
n1= scannerObject.nextInt();
n2= scannerObject.nextInt();
System.out.println("You entered "+ n1+" and "+ n2);
System.out.println("Next enter two numbers.");
System.out.println("Decimal points are allowed.");
double d1, d2;
d1= scannerObject.nextDouble();
d2= scannerObject.nextDouble();
System.out.println("You entered "+ d1+" and "+ d2);
System.out.println("Next enter two words:");
String word1= scannerObject.next();
String word2= scannerObject.next();
System.out.println("You entered \""+
word1+"\" and \""+ word2+"\"");
String junk = scannerObject.nextLine(); //To get rid of '
'
System.out.println("Next enter a line of text:");
String line = scannerObject.nextLine();
System.out.println("You entered: \""+ line +"\"");
}
} display 2.7, look at lines 19--27 But, please analyze the code before you compile and run it.) If possible, explain each line to your classmate sitting next to you (or in the breakout room).(Try not to look at the output on the next page of the textbook.) Take turns with each line, so both of you get to share. Write down any questions you had about the code in this Display. If you have no questions, write, "We/I had no

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!