Chapter 2 - Input/Output and Operators Flashcards
1
Q
// does what in a program ?
A
end-of-the-line comment
2
Q
/*
A
traditional comment
3
Q
declare a class
A
public class Class{}
4
Q
what two things must be the same in java in order for the application to run?
A
the class name and the file name
5
Q
sample code that prints out “Hello World”
A
System.out.print(“Hello World”);
6
Q
system.out.printIn
A
prints output followed by new line
7
Q
system.out.print
A
prints output without a new line
8
Q
system.out.printf
A
displays formatted data
9
Q
%s
A
string
10
Q
%d
A
is a format placeholder for int (integer)
11
Q
%f
A
double and float
12
Q
%b
A
boolean
13
Q
%n
A
newline
14
Q
%t
A
tab
15
Q
%20 does what?
A
creates a 20-character position, right justified