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

Get Ivor Horton's Beginning Java™ 2, JDK™ 5th 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.