O'Reilly logo

Java Programming for Beginners by Mark Lassoff

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The solution of variables

Fortunately, programming gives us a way of storing and retrieving data; this is called the variable. To declare a variable in Java, we first have to specify what kind of variable we're going to be using. Variables come in a number of different types. In this instance, we're content with using whole numbers, that is, numbers that do not have a specified decimal place and aren't fractions. Also, in this case, it's appropriate to use one of Java's primitive types. These are essentially as base level as we can get with information in the Java programming language; just about everything else we work with in Java is built of the primitive types.

To declare a variable of the integer primitive type, that is, whole numbers, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required