Chapter 2 - Input and output Flashcards
1
Q
println
A
ends the line of output
2
Q
A
next output goes on the same line
3
Q
printf
A
doesnt advance to next line
used to format
can have any number of arguments all of which are printed to the screen except the first - which is the formatting
4
Q
formatitng with printf
A
(“%(-/+)(number of spaces)”.float spaces)
5
Q
what is legaacy code
A
code that is old fashioned but too expensive to replace - printf is also in C
6
Q
input
A
import java.util.Scanner Scanner scanner = new Scanner(System.in);
7
Q
getting the info/user input using scanner
A
int numberofitems = scanner.nextInt()
String myword = scanner.nextLine()
read through pitfalls