56 Introduction to Java Applications Chapter (Web server info) 2 Outline

56 Introduction to Java Applications Chapter 2 Outline 2.1 Introduction 2.2 A First Program in Java: Printing a Line of Text 2.2.1 Compiling and Executing your First Java Application 2.3 Modifying Our First Java Program 2.3.1 Displaying a Single Line of Text with Multiple Statements 2.3.2 Displaying Multiple Lines of Text with a Single Statement 2.4 Displaying Text in a Dialog Box 2.5 Another Java Application: Adding Integers 2.6 Memory Concepts 2.7 Arithmetic 2.8 Decision Making: Equality and Relational Operators 2.9 (Optional Case Study) Thinking About Objects: Examining the Problem Statement Summary Terminology Self-Review Exercises Answers to Self-Review Exercises Exercises 2.1 Introduction The Java language facilitates a disciplined approach to computer program design. We now introduce Java programming and present examples that illustrate several important features of Java. Each example is analyzed one line at a time. In this chapter and Chapter 3, we present two program types in Java applications and applets. In Chapter 4 and Chapter 5, we present a detailed treatment of program development and program control in Java. 2.2 A First Program in Java: Printing a Line of Text Java uses notations that may appear strange to nonprogrammers. We begin by considering a simple application that displays a line of text. An application is a program that executes using the javainterpreter (discussed later in this section). The program and its output are shown in Fig. 2.1. This program illustrates several important features of the Java language. We consider each line of the program in detail. Each program we present in this book has line numbers included for the reader s convenience; line numbers are not part of actual Java programs. Line 9 does the real work of the program, namely displaying the phrase Welcome to JavaProgramming! on the screen. But let us consider each line in order. Line 1, // Fig. 2.1: Welcome1.java begins with //, indicating that the remainder of the line is a comment. Programmers insert comments to document programs and improve program readability. Comments also help other people read and understand a program. Comments do not cause the computer to perform any action when the program is run. The Java compiler ignores comments. We begin every program with a comment indicating the figure number and file name (line 1). Copyright 1992 2002 by Deitel & Associates, Inc. All Rights Reserved. 7/2/01
Note: In case you are looking for affordable and reliable webhost to host and run your j2ee application check Vision web and email hosting services

Leave a Reply