Professional Documents
Culture Documents
Operations
CS0007: Introduction to Computer Programming
Review
The console or console screen is…
a screen where the input and output is simple text.
When using the console for output, it is said that you are using
the…
standard output device.
The Java Application Programmer Interface (API) is…
a standard library of prewritten classes for performing specific
operations.
print
print some text to the screen
println
print some text to the screen and add a new line character at the end (go to the
next line).
Review
print and println are contained in the…
out object
Floating-Point Literals
Simply the number itself
Example: 5.8
Assumes literal is type double, so if you want it to be of type
float, you must add the F suffix
Example: 5.8F
You can also use E Notation
2.75649E4 = 2.75649 X 104 = 27564.9
Wrap-Up on Literals
Boolean Literals
Really are none, but there are two predefined boolean values
true or false
Character Literals
A single character surrounded in single quotes
'G'
String Literals
A series of characters surrounded in double quotes
"Banana!"
+= var += expr x += 5;
same as: var = var + expr same as: x = x + 5
-= var -= expr x -= 5;
same as: var = var - expr same as: x = x - 5
*= var *= expr x *= 5;
same as: var = var * expr same as: x = x * 5
/= var /= expr x /= 5;
same as: var = var / expr same as: x = x / 5
%= var %= expr x %= 5;
same as: var = var % expr same as: x = x % 5
Operator Usage Description Example
++ Increment the int x = 5;
(Increment) x++ value of the x++; // x is 6
operand by 1.
x++ same as
x += 1
or x = x + 1
-- Decrement the int y = 6;
(Decrement) x-- value of the
operand by 1.
y--; // y is 5
x-- is the same
as
x -= 1
or x = x - 1