JAVA, JAVA, JAVA Object-Oriented Problem Solving Ralph Morelli Trinity College Hartford, CT presentation slides for published by Prentice Hall Second Edition.

Slides:



Advertisements
Similar presentations
Chapter 1: Computer Systems
Advertisements

Programming with Java. Problem Solving The purpose of writing a program is to solve a problem The general steps in problem solving are: –Understand the.
1 Java Programming Basics SE-1011 Dr. Mark L. Hornick.
 2005 Pearson Education, Inc. All rights reserved Introduction.
Chapter 1: Introduction
Client Side Programming Using Java Applet Outcomes: You will be expected to know: – Java Applets and HTML file; –bytecode and platform independent programs;
The Java Programming Language
Slides prepared by Rose Williams, Binghamton University Chapter 1 Getting Started 1.1 Introduction to Java.
©2004 Brooks/Cole Chapter 1: Getting Started Sections Covered: 1.1Introduction to Programming 1.2Constructing a Java Program 1.3The print() and println()
Aalborg Media Lab 21-Jun-15 Software Design Lecture 1 “ Introduction to Java and OOP”
Outline Java program structure Basic program elements
Introduction to Java CS 331. Introduction Present the syntax of Java Introduce the Java API Demonstrate how to build –stand-alone Java programs –Java.
Chapter 1 Introduction. © 2004 Pearson Addison-Wesley. All rights reserved1-2 Outline Computer Processing Hardware Components Networks The Java Programming.
COMP 14: Intro. to Intro. to Programming May 23, 2000 Nick Vallidis.
Chapter 1 Introduction.
Copyright 2013 by Pearson Education Building Java Programs Chapter 1 Lecture 1-1: Introduction; Basic Java Programs reading:
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Java Software Solutions Foundations of Program Design Sixth Edition by Lewis.
Introduction to Java ISM 614 Summer 2001 Dr. Hamid Nemati.
Java Software Solutions Lewis and Loftus Chapter 2 1 Copyright 1997 by John Lewis and William Loftus. All rights reserved. Software Concepts -- Introduction.
Java: Chapter 1 Computer Systems Computer Programming II Aug
Java Programming, 2E Introductory Concepts and Techniques Chapter 2 Creating a Java Application and Applet.
Prepared by Uzma Hashmi Instructor Information Uzma Hashmi Office: B# 7/ R# address: Group Addresses Post message:
Java 程序设计 Java Programming Fall, Contents for Today Java Program Structure  How to Compile a Java Program  How to Run a Java Program Environment.
Java Programming, 3e Concepts and Techniques Chapter 2 - Part 2 Creating a Java Application and Applet.
LESSON 2 CREATING A JAVA APPLICATION JAVA PROGRAMMING Compiled By: Edwin O. Okech [Tutor, Amoud University]
An intro to programming. The purpose of writing a program is to solve a problem or take advantage of an opportunity Consists of multiple steps:  Understanding.
Java: Chapter 1 Computer Systems Computer Programming II.
Java Language and SW Dev’t
Chapter 1: A First Program Using C#. Programming Computer program – A set of instructions that tells a computer what to do – Also called software Software.
JAVA, JAVA, JAVA Object-Oriented Problem Solving Ralph Morelli Trinity College Hartford, CT presentation slides for published by Prentice Hall Second Edition.
1 Module Objective & Outline Module Objective: After completing this Module, you will be able to, appreciate java as a programming language, write java.
1 Computer Systems -- Introduction  Chapter 1 focuses on:  the structure of a Java application  basic program elements  preparing and executing a program.
Introduction to Programming David Goldschmidt, Ph.D. Computer Science The College of Saint Rose Java Fundamentals (Comments, Variables, etc.)
The Java Programming Language
CSC204 – Programming I Lecture 4 August 28, 2002.
© 2012 Pearson Education, Inc. All rights reserved. 1-1 Why Java? Needed program portability – Program written in a language that would run on various.
POS 406 Java Technology And Beginning Java Code
Intro and Review Welcome to Java. Introduction Java application programming Use tools from the JDK to compile and run programs. Videos at
Java Programming, Second Edition Chapter One Creating Your First Java Program.
Hello.java Program Output 1 public class Hello { 2 public static void main( String [] args ) 3 { 4 System.out.println( “Hello!" ); 5 } // end method main.
CHAPTER 3 GC Java Fundamentals. 2 BASICS OF JAVA ENVIRONMENT  The environment  The language  Java applications programming Interface API  Various.
JAVA, JAVA, JAVA Object-Oriented Problem Solving Ralph Morelli Trinity College Hartford, CT presentation slides for published by Prentice Hall Second Edition.
Chapter 1 Section 1.1 Introduction to Java Slides prepared by Rose Williams, Binghamton University Kenrick Mock, University of Alaska Anchorage.
Chapter 2: Java Fundamentals
Object-Oriented Program Development Using Java: A Class-Centered Approach, Enhanced Edition.
Chapter 1: Introduction Java Programming Language How the Java Virtual Machine Works (compiling, etc…) Update by: Dan Fleck Coming up: The Java Programming.
Java The Java programming language was created by Sun Microsystems, Inc. It was introduced in 1995 and it's popularity has grown quickly since A programming.
Chapter 3 Syntax, Errors, and Debugging Fundamentals of Java.
JAVA, JAVA, JAVA Object-Oriented Problem Solving Ralph Morelli | Ralph Walde Trinity College Hartford, CT presentation slides for published by Prentice.
© 2012 Pearson Education, Inc. All rights reserved types of Java programs Application – Stand-alone program (run without a web browser) – Relaxed.
Java Software Solutions Lewis and Loftus Chapter 2 1 Copyright 1997 by John Lewis and William Loftus. All rights reserved. Software Concepts -- Introduction.
Creating a Java Application and Applet
JAVA, JAVA, JAVA Object-Oriented Problem Solving Ralph Morelli Trinity College Hartford, CT presentation slides for published by Prentice Hall Second Edition.
© 2011 Pearson Education, publishing as Addison-Wesley Chapter 1: Computer Systems Presentation slides for Java Software Solutions for AP* Computer Science.
Introduction to Java Programming by Laurie Murphy Revised 09/08/2016.
Copyright 2010 by Pearson Education APCS Building Java Programs Chapter 1 Lecture 1-1: Introduction; Basic Java Programs reading:
 It is a pure oops language and a high level language.  It was developed at sun microsystems by James Gosling.
1 Problem Solving  The purpose of writing a program is to solve a problem  The general steps in problem solving are: Understand the problem Dissect the.
Working with Java.
Chapter 4 Assignment Statement
Chapter No. : 1 Introduction to Java.
CS180 – Week 1 Lecture 3: Foundation Ismail abumuhfouz.
Chapter 3 Assignment Statement
CS-0401 INTERMEDIATE PROGRAMMING USING JAVA
Chapter 1: Computer Systems
Java Applets.
Focus of the Course Object-Oriented Software Development
Chap 2. Identifiers, Keywords, and Types
Computer Programming-1 CSC 111
Zorah Fung University of Washington, Winter 2016
Presentation transcript:

JAVA, JAVA, JAVA Object-Oriented Problem Solving Ralph Morelli Trinity College Hartford, CT presentation slides for published by Prentice Hall Second Edition

Java, Java, Java Object Oriented Problem Solving Chapter 1 Java Program Design and Development

Java, Java, Java, 2E by R. Morelli Copyright All rights reserved. Chapter 1: Java Program Development Objectives Know the basic steps involved in the program development process. Understand the difference between a Java application and a Java applet. Understand how a Java program is translated into machine language. Know how to edit, compile, and run Java programs. Understand some basic Java language elements. Know how to use simple output operations.

Java, Java, Java, 2E by R. Morelli Copyright All rights reserved. Chapter 1: Java Program Development Outline Designing Good Programs Java Java Language Summary Compiling and Executing a Java Program Applications and Applets From the Java Library: The System and PrintStream classes. In the Laboratory: Editing, Compiling, and Running an Applet

Java, Java, Java, 2E by R. Morelli Copyright All rights reserved. Chapter 1: Java Program Development Designing Good Programs Always precede coding with careful design. Remember: The sooner you begin to type code, the longer the program will take to finish. Design includes designing classes, data, methods, and algorithms. Design is followed by coding, testing, and revision.

Java, Java, Java, 2E by R. Morelli Copyright All rights reserved. Chapter 1: Java Program Development The Software Lifecycle In the waterfall model of software development, each phase is finished is completed before the next phase is begun.

Java, Java, Java, 2E by R. Morelli Copyright All rights reserved. Chapter 1: Java Program Development The Program Development Process Problem Specification Problem Decomposition Design Specification Data, Methods, and Algorithms Coding into Java Testing, Debugging, and Revising

Java, Java, Java, 2E by R. Morelli Copyright All rights reserved. Chapter 1: Java Program Development Object-Oriented Program Development

Java, Java, Java, 2E by R. Morelli Copyright All rights reserved. Chapter 1: Java Program Development Problem Specification What exactly is the problem to be solved? How will the program be used? How will the program behave? Problem Specification: Design a class that will represent a simple geometric rectangle with a given length and width. The definition of this class should make it possible to create rectangles and calculate their areas.

Java, Java, Java, 2E by R. Morelli Copyright All rights reserved. Chapter 1: Java Program Development Problem Decomposition Divide-and-Conquer: What objects will be used and how will they interact? Nouns: In OOD, choosing objects means looking for nouns in the problem specification. Problem Specification: Design a class that will represent a simple geometric rectangle with a given length and width. The definition of this class should make it possible to create rectangles and calculate their areas.

Java, Java, Java, 2E by R. Morelli Copyright All rights reserved. Chapter 1: Java Program Development Object Design Questions What role will the object perform? What data or information will it need? –Look for nouns. Which actions will it take? –Look for verbs. What interface will it present to other objects? –These are public methods. What information will it hide from other objects? –These are private.

Java, Java, Java, 2E by R. Morelli Copyright All rights reserved. Chapter 1: Java Program Development Design Specification for a Rectangle Class Name: Rectangle Role: To represent a geometric rectangle Attributes (Information or instance variables) - Length: A variable to store rectangle’s length (private) - Width: A variable to store rectangle's width (private) Behaviors (public methods) -Rectangle(): A method to set a rectangle’s length and width -calculateArea(): A method to calculate a rectangle’s area

Java, Java, Java, 2E by R. Morelli Copyright All rights reserved. Chapter 1: Java Program Development UML Design Specification UML Class Diagram Class Name What data does it need? What behaviors will it perform? Public interface Hidden information Instance variables -- memory locations used for storing the information needed. Methods -- blocks of code used to perform a specific task.

Java, Java, Java, 2E by R. Morelli Copyright All rights reserved. Chapter 1: Java Program Development Method Design What specific task will the method perform? What information will it need to perform its task? What result will the method produce? What algorithm (step-by-step description of the solution) will the method use?

Java, Java, Java, 2E by R. Morelli Copyright All rights reserved. Chapter 1: Java Program Development Method Specification: calculateArea() Method Name: calculateArea() Task: To calculate the area of a rectangle Information Needed (variables) –Length: A variable to store the rectangle's length (private) –Width: A variable to store the rectangle's width (private) Algorithm: area = length x width

Java, Java, Java, 2E by R. Morelli Copyright All rights reserved. Chapter 1: Java Program Development Coding into Java public class Rectangle // Class header { private double length; // Instance variables private double width; public Rectangle(double l, double w) // Constructor method { length = l; width = w; } public double calculateArea() // Access method { return length * width; } // calculateArea() } // Rectangle class

Java, Java, Java, 2E by R. Morelli Copyright All rights reserved. Chapter 1: Java Program Development Java Language Summary: Syntax The syntax of a programming language is the set of rules that determines whether its statements are correctly formulated. Example Rule: All Java statements must end with a semincolon. Syntax error: sum = 0 Syntax errors can be detected by the compiler, which will report an error message.

Java, Java, Java, 2E by R. Morelli Copyright All rights reserved. Chapter 1: Java Program Development Java Language Summary: Semantics The semantics of a programming language is the set of rules that determine the meaning of its statements. Example Rule: In a + b, the + operator will add a and b. Semantic error: User intended to add a and b but coded a - b. Semantic errors cannot be detected by the compiler, because it can’t read the programmer’s mind.

Java, Java, Java, 2E by R. Morelli Copyright All rights reserved. Chapter 1: Java Program Development Java Language Summary: Program Elements A Java program is made up of class definitions. A class definition contains a header and a body. A method is a named section of code that can be called by its name. Multi-line and single-line comments are used to document the code.

Java, Java, Java, 2E by R. Morelli Copyright All rights reserved. Chapter 1: Java Program Development public class Example extends Object // Class header { // Start of class body private double num = 5.0; // Instance variable public void print() // Method definition header { // Start of method body System.out.println(num); // Output statement } // print() // End of print method body public static void main(String args[]) // Method definition header { // Start of method body Example example; // Reference variable declaration example = new Example(); // Object instantiation statement example.print(); // Method call } // main() // End of method body } // Example // End of class body Java Language Summary: Class Definition

Java, Java, Java, 2E by R. Morelli Copyright All rights reserved. Chapter 1: Java Program Development Java Language Summary: Access Rules Packages contain classes which contain members (methods and fields). Access is determined from the top down. If no explicit declaration given, a default is used.

Java, Java, Java, 2E by R. Morelli Copyright All rights reserved. Chapter 1: Java Program Development Java Language Summary: Keywords abstractdefault if private throw boolean do implementsprotected throws break double import public transient byte else instanceof return try case extends int short void catch final interfacestatic volatile char finally long super while class float native switch const for new synchronized continue goto package this

Java, Java, Java, 2E by R. Morelli Copyright All rights reserved. Chapter 1: Java Program Development Java Language Summary: Identifiers An identifier must begin with a letter (A to Z, a to z) and may be followed by any number of letters or digits (0 to 9) or underscores (_). An identifier may not be identical to a Java keyword. The scope of an identifier determines where it may be used in the program. Instance variables (isEating) and instance methods (eat()) have class scope and may be used anywhere within the class.

Java, Java, Java, 2E by R. Morelli Copyright All rights reserved. Chapter 1: Java Program Development Primitive Data Types

Java, Java, Java, 2E by R. Morelli Copyright All rights reserved. Chapter 1: Java Program Development Applications vs. Applets Java Applications Stand-alone program Runs independently Has a main() method No HTML file Run using JDK’s java interpreter Java Applets Embedded program. Runs in a Web browser No main() method. Requires an HTML file Run using JDK’s appletviewer

Java, Java, Java, 2E by R. Morelli Copyright All rights reserved. Chapter 1: Java Program Development The HelloWorld Application /* * The HelloWorld application program */ public class HelloWorld // Class header { // Start of class body public static void main(String argv[]) // Main method { System.out.println("Hello world!"); } // End of main } // End of HelloWorld Multi-line comment block Single-line comments Execution starts on the first line of main()

Java, Java, Java, 2E by R. Morelli Copyright All rights reserved. Chapter 1: Java Program Development The HelloWorld Applet /* * HelloWorld applet program */ import java.applet.Applet; // Import the Applet class import java.awt.Graphics; // and the Graphics class public class HelloWorld extends Applet // Class header { // Start of body public void paint(Graphics g) // The paint method { g.drawString("HelloWorld",10,10); } // End of paint } // End of HelloWorld These statements import Java class names. This statement displays “HelloWorld” on the browser window.

Java, Java, Java, 2E by R. Morelli Copyright All rights reserved. Chapter 1: Java Program Development Editing, Compiling, and Running

Java, Java, Java, 2E by R. Morelli Copyright All rights reserved. Chapter 1: Java Program Development The Java Development Process Step 1: Editing the Program –Software: Any text editor will do. Step 2: Compiling the Program –Software: Java Development Kit (JDK) –JDK: javac HelloWorld.java Step 3: Running the Program –JDK: java HelloWorld (Application) –JDK: appletviewer file.html (Applet)

Java, Java, Java, 2E by R. Morelli Copyright All rights reserved. Chapter 1: Java Program Development Editing a Java Program Software: A text editor (vi, emacs, BBEdit). Program source code must be saved in a text file named ClassName.java where ClassName is the name of the public class contained in the file. Remember: Java class names and file names are case sensitive.

Java, Java, Java, 2E by R. Morelli Copyright All rights reserved. Chapter 1: Java Program Development Compiling a Java Program Compilation translates the source program into Java bytecode. –Bytecode is platform-independent JDK Command: javac HelloWorld.java Successful compilation will create the bytecode class file: HelloWorld.class

Java, Java, Java, 2E by R. Morelli Copyright All rights reserved. Chapter 1: Java Program Development Running a Java Application The class file (bytecode) is loaded into memory and interpreted by the Java Virtual Machine (JVM) JDK Command: java HelloWorld

Java, Java, Java, 2E by R. Morelli Copyright All rights reserved. Chapter 1: Java Program Development Running a Java Applet Running an applet requires an HTML file containing an tag: JDK Command: appletviewer file.html Browser: Open the applet’s HTML file... <APPLET CODE=“HelloWorld.class” WIDTH=200 HEIGHT=200>...

Java, Java, Java, 2E by R. Morelli Copyright All rights reserved. Chapter 1: Java Program Development Running a HelloApplet Try running HelloAppletHelloApplet

Java, Java, Java, 2E by R. Morelli Copyright All rights reserved. Chapter 1: Java Program Development Coding into Java Stepwise Refinement is the right way to code. -Code small stages at a time, testing in between. -Errors are caught earlier. Syntax rules must be followed. -Syntax is the set of rules that determine whether a particular statement is correctly formulated Semantics must be understood. -Semantics refers to the meaning (effect on the program) of each Java statement.

Java, Java, Java, 2E by R. Morelli Copyright All rights reserved. Chapter 1: Java Program Development Testing, Debugging, and Revising Coding, testing, and revising a program is an iterative process. The java compiler catches syntactic errors, producing error messages. The programmer must test thoroughly for semantic errors. -Semantic errors are errors which manifest themselves through illogical output or behavior. -Errors are corrected in the debugging phase

Java, Java, Java, 2E by R. Morelli Copyright All rights reserved. Chapter 1: Java Program Development Writing Readable Programs Style, in addition to working code, is the mark of a good programmer. Style consists of: -Readability. Code should be well-documented and easy to understand. - Clarity. Conventions should be followed and convoluted code avoided. -Flexibility. Code should be designed for easy maintenance and change.

Java, Java, Java, 2E by R. Morelli Copyright All rights reserved. Chapter 1: Java Program Development Java Library: System and PrintStream The java.lang.System class contains PrintStream objects that perform Input/Output (I/O). The java.lang.PrintStream class contains the print() and println() methods that perform output.

Java, Java, Java, 2E by R. Morelli Copyright All rights reserved. Chapter 1: Java Program Development Example: OldMacDonald Program public class OldMacDonald // Class header { // Start of body public static void main(String argv[]) // Main method { System.out.println(“Old MacDonald had a farm.”); System.out.println(“E I E I O.”); System.out.println(“And on his farm he had a duck.”); System.out.println(“E I E I O.”); System.out.println(“With a quack quack here.”); System.out.println(“And a quack quack there.”); System.out.println(“Here a quack, there a quack.”); System.out.println(“Everywhere a quack quack.”); System.out.println(“Old MacDonald had a farm”); System.out.println(“E I E I O.”); } // End of main } // End of OldMacDonald

Java, Java, Java, 2E by R. Morelli Copyright All rights reserved. Chapter 1: Java Program Development Qualified Names A qualified name takes the form reference.elementName where reference refers to some object (or class or package) and elementName is the name of one of the object’s (or class’s or package’s) elements. Use: To refer to elements in Java’s package, class, element hierarchy. Context dependent. System.out.println(); //println() method in System.out class pet1.eat(); // eat() method in pet1 object java.awt.Button // Button class in java.awt package

Java, Java, Java, 2E by R. Morelli Copyright All rights reserved. Chapter 1: Java Program Development In the Laboratory: FirstApplet Objectives –To familiarize you with the process of editing, compiling, and running a Java applet. –To introduce the stepwise refinement coding style. –To provide some examples of both syntax and semantic errors.

Java, Java, Java, 2E by R. Morelli Copyright All rights reserved. Chapter 1: Java Program Development FirstApplet Demo Click here to run the FirstApplet and read its source code.Click here to run the FirstApplet and read its source code.

Java, Java, Java, 2E by R. Morelli Copyright All rights reserved. Chapter 1: Java Program Development Program Walkthrough: Documentation The program begins with a comment block: Comments should be used throughout the program to clarify and document the code. /* * File: FirstApplet.java * Author: Java Java Java * Description: This applet plays the click-me-not game * with the user. */

Java, Java, Java, 2E by R. Morelli Copyright All rights reserved. Chapter 1: Java Program Development Program Walkthrough: Documentation Documentation comments /** … */ are used to document the class and its methods. The JDK javadoc utility can turn such comments into HTML documentation. Example: See FirstApplet.html to see the documentation generated for this program.FirstApplet.html /** * The FirstApplet class plays click-me-not with the user. Java Java Java */

Java, Java, Java, 2E by R. Morelli Copyright All rights reserved. Chapter 1: Java Program Development Program Walkthrough: Import Statement An import statement is a convenience that lets you refer to a library class by its short name (Applet) instead by its fully qualified name. Java library classes are organized into packages. In java.applet.Applet we mean the Applet class in the java.applet package. In a qualified name of the form X.Y.Z the last item (Z) is the referent and (X.Y) are its qualifiers. import java.applet.Applet; import java.awt.*; import java.awt.event.*;

Java, Java, Java, 2E by R. Morelli Copyright All rights reserved. Chapter 1: Java Program Development Program Walkthrough: Class Definition Class definition : header plus body. public class FirstApplet extends Applet implements ActionListener { public void actionPerformed(ActionEvent e) { } FirstApplet class is an extension of the Applet class FirstApplet implements ActionListener interface. A block is a set of statements enclosed within braces {}. Header Body

Java, Java, Java, 2E by R. Morelli Copyright All rights reserved. Chapter 1: Java Program Development Program Walkthrough: Variables A variable is a memory location that stores a piece of data or an object. A variable declaration gives the variable’s type (Button) and name (clickMe): private Button clickMe; // The button Variable names should be descriptive and should follow a distinctive style: clickMe

Java, Java, Java, 2E by R. Morelli Copyright All rights reserved. Chapter 1: Java Program Development Program Walkthrough: init() Method A method is a named module that’s called to do some task. The init() method is where the applet starts. It is called automatically when the applet is executed. A method definition has a header and a body. public void init() { clickMe = new Button(”Click Me Not!"); clickMe.addActionListener(this); add(clickMe); } // init() Header Body

Java, Java, Java, 2E by R. Morelli Copyright All rights reserved. Chapter 1: Java Program Development The actionPerformed()Method The actionPerformed() method handles user actions such as button clicks. public void actionPerformed (ActionEvent e) { if (clickMe.getLabel().equals(“Click Me!”)) clickMe.setLabel(“Click Me Not!”); else clickMe.setLabel(“Click Me!”); } //actionPerformed()

Java, Java, Java, 2E by R. Morelli Copyright All rights reserved. Chapter 1: Java Program Development Stepwise Refinement Stepwise refinement is a coding and testing strategy that employs the divide-and- conquer principle. It helps to break a large task into smaller, more manageable subtasks. It helps to localize and identify errors in your code.

Java, Java, Java, 2E by R. Morelli Copyright All rights reserved. Chapter 1: Java Program Development Stepwise Refinement of FirstApplet Stage 1: Input the comment block, the import statements, and class definition. Compile and test. Stage 2: Input the variable declarations. Compile and test. Stage 3: Input the init() method. Compile and test. Stage 4: Complete actionPerformed() method. Compile and test.

Java, Java, Java, 2E by R. Morelli Copyright All rights reserved. Chapter 1: Java Program Development Summary: Technical Terms algorithm applet application assignment expression block (compound statement declaration statement executable statement flow of control HyperText Markup Language (HTML) identifier instance variable (field) literal value method method invocation object instantiation operator package primitive data type pseudocode semantics software life cycle stepwise refinement stub class stub method syntax variable waterfall model

Java, Java, Java, 2E by R. Morelli Copyright All rights reserved. Chapter 1: Java Program Development Summary: Key Points A Java applet is an embedded program that runs within the context of a WWW browser. Java applets are identified in HTML documents by using the tag. A Java application runs in stand-alone mode. Applications must have a main() method. Java programs are first compiled into bytecode and then interpreted by the Java Virtual Machine (JVM).

Java, Java, Java, 2E by R. Morelli Copyright All rights reserved. Chapter 1: Java Program Development Summary: Key Points A Java source program must be stored in a file that has a.java extension. A Java bytecode file has the same name as the source file but a.class extension. The name of the source file must be identical to the name of the public class defined in the file. Java is case sensitive.

Java, Java, Java, 2E by R. Morelli Copyright All rights reserved. Chapter 1: Java Program Development Summary: Key Points Good program design requires that each object and each method have a well-defined task. Coding Java should follow the stepwise refinement approach. A stub method is a method with a complete header and an incomplete body.

Java, Java, Java, 2E by R. Morelli Copyright All rights reserved. Chapter 1: Java Program Development Summary: Key Points A syntax error results when a statement violates one of Java’s grammar rules. A semantic error or logic error is an error in the program’s design and cannot be detected by the compiler. Testing a program can only reveal the presence of bugs, not their absence. Good programs should be designed for readability, clarity, and flexibility.