Please enable JavaScript to use CodeHS

CodeHS Glossary

Variable Java

A symbol or container that holds a value. A variable has a type and a value. Variable names should be written in lowerCamelCase, and the name should indicate what value the variable represents. For example, if we wanted to make a variable in Java to represent the number of apples we have, we would write: ``` int numApples = 9; ``` This makes a variable of type `int`, and sets its initial value to 9. We want the type to be `int` because this variable will hold an integer value (a whole number).