GEEN163 Honors 1
Java Basics
GEEN163 Honors 2
Java Basics
Which of these are valid names? Which of these are valid names?
a) abc e) ABC i) a_1 a) abc e) ABC i) a_1
b) m/h f) 25or6to4 j) studentNumber b) m/h f) 25or6to4 j) studentNumber
c) main g) 1_time k) Main c) main g) 1_time k) Main
d) double h) first name l) ______ d) double h) first name l) ______
GEEN163 Honors 3
Java Basics
Common Operations on
Variables Variables
• Variables hold data. They represent a • Common Operations for many types of
memory location. variables include these four
– Declaration Construct an variable
• Variables have a:
Initialization and optionally initialize its value
– Name – Assignment Modify the value of an variable
– Type – Input Read the value from keyboard
– Value – Output Write the value of an variable
• Before you set a variable’s value, it may to the screen
not have a reliable value.
GEEN163 Honors 4
Java Basics
GEEN163 Honors 5
Java Basics
GEEN163 Honors 6
Java Basics
GEEN163 Honors 7
Java Basics
GEEN163 Honors 8
Java Basics
GEEN163 Honors 9