What is the scanner class
import java.util.Scanner;
What do Scanner objects work with?
-System.in
-So to create a Scanner object and connect it to the System.in object
Scanner keyboard= new Scanner (System.in);
What is a keyboard buffer
It is a temporary storage area.
-When you type something in the console and press enter, everything you typed plus the enter key \n is temporarily stored in memory
What is field width
-When you use a format specifier, like %d or %f you can add a number to control how many spaces wide the output should be
Eg: %6d
%=start of a format specifier
6=field width (6 spaces wide)
d=data type
Eg: if the number 9, then the output would be 5 spaces and then the number 9 because it is one digit so it takes up only one spot.
-if the number is longer java just expands the width it does not cut the number off
What happens when you print with %f
When you print with %f java automatically fills in zeros to make exactly 6 digits after the decimal
eg:
double number=1278.92
system.out.printf(“the number is %f\n”, number);
output: the number is 1278.920000