O'Reilly logo

Real World XML by Steven Holzner

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

Creating Variables in Java

We've seen that Java applications are class based, and we've gotten enough Java down now to create basic programs. The next step in Java programming is to start storing your data so that you can work on that data. As with JavaScript, variables serve as locations in memory in which you can store your data. However, unlike JavaScript, Java variables are strongly typed, which means that you have to declare a type for each variable and be careful about mixing those types.

For example, one of the most common variable types is int, which stands for “integer.” This type sets aside 4 bytes of memory, which means that you can store values between -2,147,483,648 and 2,147,483,647 in int variables. Quite a few different variable ...

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