Hour 5. Storing and Changing Information in a Program

In Hour 2, “Writing Your First Program,” you used a variable, a special storage place that is designed to hold information. The information stored in variables can be changed as your program runs, which is why they're called variables.

Your first program stored a string of text in a variable called greeting. Strings are only one type of information that can be stored in variables. They also can hold characters, integers, floating-point numbers, and other things.

During this hour, you'll learn more about using variables in your Java programs, including the following topics:

  • Creating variables

  • The different types of variables

  • Storing values into variables

  • Using variables in mathematical expressions ...

Get SAMS Teach Yourself Programming with Java™ in 24 Hours, FOURTH 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.