2.2. Writing Simple Programs

 
[Page 27]

Chapter 2. Primitive Data Types and Operations

Mayan God Shel, Mexico. Photographer: Philip Coblentz. Courtesy Brand X Pictures.

Objectives

  • To write Java programs to perform simple calculations ( §2.2).

  • To use identifiers to name variables , constants, methods , and classes ( §2.3).

  • To use variables to store data ( § §2.4 “2.5).

  • To program with assignment statements and assignment expressions ( §2.5).

  • To use constants to store permanent data ( §2.6).

  • To declare Java primitive data types: byte , short , int , long , float , double , and char ( § §2.7 “2.9).

  • To use Java operators to write numeric expressions ( § §2.7 “2.8).

  • To represent characters using the char type ( §2.9).

  • To represent a string using the String type ( §2.10).

  • To obtain input using the JOptionPane input dialog boxes ( §2.11).

  • To obtain input from the console using the Scanner class ( §2.13).

  • To become familiar with Java documentation, programming style, and naming conventions ( §2.14).

  • To distinguish syntax errors, runtime errors, and logic errors ( §2.15).

  • To debug logic errors ( §2.16).


[Page 28]

2.1. Introduction

In the preceding chapter, you learned how to create, compile, and run a Java program. In this chapter, you will be introduced to Java primitive data types and related subjects, such as variables, constants, data types, operators, and expressions. You will learn how to write programs using primitive data types, input and output, and simple calculations.

 


Introduction to Java Programming-Comprehensive Version
Introduction to Java Programming-Comprehensive Version (6th Edition)
ISBN: B000ONFLUM
EAN: N/A
Year: 2004
Pages: 503

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net