Hour 5. Storing and Changing Information in a Program

What You’ll Learn in This Hour:

• Creating variables

• Using the different types of variables

• Storing values into variables

• Using variables in mathematical expressions

• Storing one variable’s value into another variable

• Increasing and decreasing a variable’s value

In Hour 2, “Writing Your First Program,” you used a variable, a special storage place designed to hold information. The information stored in variables can be changed as a program runs. Your first program stored a string of text in a variable. Strings are only one type of information that can be stored in variables. They also can hold characters, integers, floating-point numbers, and objects.

During this hour, you learn more ...

Get Sams Teach Yourself Java™ in 24 Hours, Sixth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.