Chapter 2. Introduction to Java Applications

What’s in a name? That which we call a rose By any other name would smell as sweet.

William Shakespeare

When faced with a decision, I always ask, “What would be the most fun?”

Peggy Walker

The chief merit of language is clearness.


One person can make a difference and every person should try.

John F. Kennedy


In this chapter you’ll learn:

• To write simple Java applications.

• To use input and output statements.

• Java’s primitive types.

• To use arithmetic operators.

• The precedence of arithmetic operators.

• To write decision-making statements.

• To use relational and equality operators.

2.1 Introduction

2.2 Your First Program in Java: Printing a Line of Text

Get Java™ for Programmers: Deitel Developer Series, Second 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.