In: Computer Science
1. In Java, what does the last line mean? What does scan.nextLine(); mean?
import java.util.Scanner;
Scanner scan = new Scanner (System.in);
message = scan.nextLine();
2. Assuming that a Random object has been created called generator, what is the range of the result of each of the following expressions? Also, do each example using nextFloat()
•generator.nextInt(20)
•generator.nextInt(8) + 1
•generator.nextInt(100) – 50
message = scan.nextLine() means reads the string from the console
•generator.nextInt(20) : will generate the number between 0-20
•generator.nextInt(8) + 1: wll generate numbers between 1-9
•generator.nextInt(100) – 50 : will generate from -50 to 50
nextFloat() is user to generate floating point numbers