O'Reilly logo

Ivor Horton's Beginning Java™ 2, JDK™ 5th Edition by Ivor Horton

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

Chapter 2. Programs, Data, Variables, and Calculation

In this chapter you'll look at the entities in Java that are not objects—numbers and characters. This will give you all the elements of the language you need to perform numerical calculations, and you'll apply these in a few working examples.

In this chapter you'll learn:

  • How to declare and define variables of the basic integer and floating-point types

  • How to write an assignment statement

  • How integer and floating-point expressions are evaluated

  • How to output data from a console program

  • How mixed integer and floating-point expressions are evaluated

  • What casting is and when you must use it

  • What boolean variables are

  • What determines the sequence in which operators in an expression are executed

  • How to include comments in your programs

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