6. Store and Change Information in a Mod

In This Chapter

Create a variable

Use different types of variables

Store values in variables

Use variables in mathematical expressions

Store one variable’s value in another variable

Increase and decrease a variable’s value

In Chapter 4, “Start Writing Java Programs,” 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 chapter, you learn more about using variables in your Java programs. ...

Get Absolute Beginner’s Guide to Minecraft® Mods Programming, Second 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.