Introduction to Java Applications
- 2.1 Introduction
- 2.2 Your First Program in Java: Printing a Line of Text
- 2.3 Modifying Your First Java Program
- 2.4 Displaying Text with printf
- 2.5 Another Application: Adding Integers
- 2.6 Memory Concepts
- 2.7 Arithmetic
- 2.8 Decision Making: Equality and Relational Operators
- 2.9 Wrap-Up
- Self-Review Exercises
- Answers to Self-Review Exercises
- Making a Difference
- 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
This chapter introduces Java application programming. We begin with examples of programs that display messages on the screen. We then present a program that obtains two numbers from a user, calculates their sum and displays the result. You'll learn how to instruct the computer to perform arithmetic calculations and save their results for later use. The last example demonstrates how to make decisions. The application compares numbers, then displays messages that show the comparison results.
This chapter uses tools from the JDK to compile and run programs. We've also posted Dive Into® videos at www.deitel.com/books/jhtp9/ to help you get started with the popular Eclipse and NetBeans integrated development environments.