Java the UML Way: Integrating Object-Oriented Design and Programming



Similar documents
Computing Concepts with Java Essentials

Java 6 'th. Concepts INTERNATIONAL STUDENT VERSION. edition

Java Application Developer Certificate Program Competencies

RARITAN VALLEY COMMUNITY COLLEGE ACADEMIC COURSE OUTLINE. CISY 105 Foundations of Computer Science

Fundamentals of Java Programming

Android Application Development Course Program

core. Volume I - Fundamentals Seventh Edition Sun Microsystems Press A Prentice Hall Title ULB Darmstadt

Java EE Web Development Course Program

Java (12 Weeks) Introduction to Java Programming Language

Thomas Jefferson High School for Science and Technology Program of Studies Foundations of Computer Science. Unit of Study / Textbook Correlation

Japan Communication India Skill Development Center

Applets, RMI, JDBC Exam Review

The Sun Certified Associate for the Java Platform, Standard Edition, Exam Version 1.0

Syllabus for CS 134 Java Programming

IT6503 WEB PROGRAMMING. Unit-I

Java 7 Recipes. Freddy Guime. vk» (,\['«** g!p#« Carl Dea. Josh Juneau. John O'Conner

Japan Communication India Skill Development Center

JAVA. EXAMPLES IN A NUTSHELL. O'REILLY 4 Beijing Cambridge Farnham Koln Paris Sebastopol Taipei Tokyo. Third Edition.

TYLER JUNIOR COLLEGE School of Continuing Studies 1530 SSW Loop 323 Tyler, TX

Japan Communication India Skill Development Center

Web Development in Java

Specialized Programme on Web Application Development using Open Source Tools

BHARATHIAR UNIVERSITY COIMBATORE SCHOOL OF DISTANCE EDUCATION

Management Information Systems 260 Web Programming Fall 2006 (CRN: 42459)

An Introduction to Object-Oriented Programming with

Course Number: IAC-SOFT-WDAD Web Design and Application Development

KITES TECHNOLOGY COURSE MODULE (C, C++, DS)

ARIZONA CTE CAREER PREPARATION STANDARDS & MEASUREMENT CRITERIA SOFTWARE DEVELOPMENT,

Java SE 8 Programming

Japan Communication India Skill Development Center

An Overview of Java. overview-1

Specialized Programme on Web Application Development using Open Source Tools

NEW YORK CITY COLLEGE OF TECHNOLOGY/CUNY Computer Systems Technology Department

Java Software Structures

ARIZONA CTE CAREER PREPARATION STANDARDS & MEASUREMENT CRITERIA SOFTWARE DEVELOPMENT,

Computer Science. 232 Computer Science. Degrees and Certificates Awarded. A.S. Degree Requirements. Program Student Outcomes. Department Offices

Programming and Software Development CTAG Alignments

CompuScholar, Inc. Alignment to Utah's Computer Programming II Standards

COMPUTER SCIENCE. 1. Computer Fundamentals and Applications

Java - gently. Originaux. Prérequis. Objectifs

COURSE OUTLINE. Prerequisites: Course Description:

Facebook Twitter YouTube Google Plus Website

Computer Science. Computer Science 207. Degrees and Certificates Awarded. A.S. Computer Science Degree Requirements. Program Student Outcomes

PROBLEM SOLVING SEVENTH EDITION WALTER SAVITCH UNIVERSITY OF CALIFORNIA, SAN DIEGO CONTRIBUTOR KENRICK MOCK UNIVERSITY OF ALASKA, ANCHORAGE PEARSON

Course Name: Course in JSP Course Code: P5

El Dorado Union High School District Educational Services

THE OPEN UNIVERSITY OF TANZANIA

Charles Dierbach. Wiley

DE 6211 DISTANCE EDUCATION. M.Sc. (IT) DEGREE EXAMINATION, MAY PRINCIPLES OF INFORMATION TECHNOLOGY. (2002 onwards) PART A (10 3 = 30 marks)

COMMUNITY COLLEGE OF CITY UNIVERSITY CITY UNIVERSITY OF HONG KONG

Virtual Credit Card Processing System

Basic Programming and PC Skills: Basic Programming and PC Skills:

Java and J2EE (SCJA Exam CX ) 50 Cragwood Rd, Suite 350 South Plainfield, NJ 07080

C# Cookbook. Stephen Teilhet andjay Hilyard. O'REILLY 8 Beijing Cambridge Farnham Köln Paris Sebastopol Taipei Tokyo '"J""'

Domains and Competencies

BELEN JESUIT PREPARATORY SCHOOL Computer Science Department COURSE DESCRIPTIONS. And OBJECTIVES

Visual Basic. murach's TRAINING & REFERENCE

Java SE 7 Programming

Java SE 7 Programming

Java SE 7 Programming

CS506 Web Design and Development Solved Online Quiz No. 01

Enterprise Java. Where, How, When (and When Not) to Apply Java in Client/Server Business Environments. Jeffrey Savit Sean Wilcox Bhuvana Jayaraman

PLV Goldstein 315, Tuesdays and Thursdays, 6:00PM-7:50PM. Tuesdays and Thursdays, 4:00PM-5:30PM and 7:50PM 9:30PM at PLV G320

DIABLO VALLEY COLLEGE CATALOG

Course MS10975A Introduction to Programming. Length: 5 Days

Specialized Android APP Development Program with Java (SAADPJ) Duration 2 months

WESTMORELAND COUNTY PUBLIC SCHOOLS Integrated Instructional Pacing Guide and Checklist Computer Math

Eastern Washington University Department of Computer Science. Questionnaire for Prospective Masters in Computer Science Students

Eastern Washington University Department of Computer Science. Questionnaire for Prospective Masters in Computer Science Students

DIPLOMADO DE JAVA - OCA

JAVA IN A NUTSHELL O'REILLY. David Flanagan. Fifth Edition. Beijing Cambridge Farnham Köln Sebastopol Tokyo

Free Java textbook available online. Introduction to the Java programming language. Compilation. A simple java program

VIRTUAL LABORATORY: MULTI-STYLE CODE EDITOR

AP Computer Science A - Syllabus Overview of AP Computer Science A Computer Facilities

JAVA/J2EE Course Syllabus

Lecture 1 Introduction to Android

Java Interview Questions and Answers

Curriculum Map. Discipline: Computer Science Course: C++

Computer Science. Computer Science 213. Faculty and Offices. Degrees and Certificates Awarded. AS Computer Science Degree Requirements

Computer and Information Sciences

PG DAC. Syllabus. Content. Eligibility Criteria

TATJA: A Test Automation Tool for Java Applets

Free Java textbook available online. Introduction to the Java programming language. Compilation. A simple java program

Summit Public Schools Summit, New Jersey Grade Level / Content Area: Mathematics Length of Course: 1 Academic Year Curriculum: AP Computer Science A

Table of Contents. Adding Build Targets to the SDK 8 The Android Developer Tools (ADT) Plug-in for Eclipse 9

TECHNOLOGY Computer Programming II Grade: 9-12 Standard 2: Technology and Society Interaction

Computer Science III Advanced Placement G/T [AP Computer Science A] Syllabus

OKLAHOMA SUBJECT AREA TESTS (OSAT )

Java Thin-Client Programming for a Network Computing Environment

Efficiency of Web Based SAX XML Distributed Processing

Using Web-based Tools to Enhance Student Learning and Practice in Data Structures Course

AP Computer Science Java Subset

: provid.ir

Bachelor of Games and Virtual Worlds (Programming) Subject and Course Summaries

1.00 Lecture 1. Course information Course staff (TA, instructor names on syllabus/faq): 2 instructors, 4 TAs, 2 Lab TAs, graders

Transcription:

Java the UML Way: Integrating Object-Oriented Design and Programming by Else Lervik and Vegard B. Havdal ISBN 0-470-84386-1 John Wiley & Sons, Ltd. Table of Contents Preface xi 1 Introduction 1 1.1 Preliminaries for Reading This Book 2 1.2 Contemplating a Computer 3 1.3 Java Applications and Java Applets 5 1.4 JavaScript and JSP 6 1.5 How This Book is Structured 7 1.6 A Small Example Program 9 1.7 Examples of Applets 15 1.8 New Concepts in This Chapter 17 1.9 Review Problems 19 1.10 Programming Problems 20 2 Variables, Data Types, and Expressions 21 2.1 Example 22 2.2 Data and Variables 22 2.3 Algorithms, Programming Errors, and Test Data 26 2.4 Statements, Blocks, and Names 28 2.5 Variables and Constants 30 2.6 Data Types 34 2.7 Assignments and Mathematical Expressions 40 2.8 Type Conversion 43 2.9 Calculations for Our Renovation Project 45 2.10 New Concepts in This Chapter 47 2.11 Review Problems 49 2.12 Programming Problems 49 3 Using Ready-Made Classes 51 3.1 Objects as Models of Reality 52 3.2 Using Ready-Made Classes 55 3.3 The Random Class 60 3.4 The String Class 63 3.5 Organizing Classes in Packages 70 3.6 Class Methods and Class Constants in the Java Library 71 3.7 Reading Data from the User 73 3.8 New Concepts in This Chapter 77 3.9 Review Problems 79 3.10 Programming Problems 79 4 Constructing Your Own Classes 81 4.1 Creating Classes 82 1

4.2 Programming a Class 85 4.3 Access Modifiers Private and Public 91 4.4 Contents of a Class 92 4.5 One More Class and Some New Operators 101 4.6 Introduction to Applets 106 4.7 Introduction to Graphics 111 4.8 New Concepts in This Chapter 118 4.9 Review Problems 120 4.10 Programming Problems 121 5 Selection as a Control Structure 123 5.1 A Simple Calculator 124 5.2 A Selection is a Control Structure 126 5.3 Blocks inside Methods 131 5.4 The if Statement 133 5.5 Nested if and Multiple-Choice Statements 137 5.6 Boolean Expressions 144 5.7 The Multiple-Choice Statement switch 150 5.8 Comparing Computed Decimal Numerals 153 5.9 The Conditional Operator?: 153 5.10 New Concepts in This Chapter 154 5.11 Review Problems 155 5.12 Programming Problems 156 6 Loops as a Control Structure 159 6.1 Counter-Controlled Loops 160 6.2 A Loop with a General Condition 163 6.3 A Graphics Example 166 6.4 The for Statement 168 6.5 Nested Control Structures 169 6.6 The do-while Statement 171 6.7 Choosing the Right Loop Statement 173 6.8 Controlling Input Data 174 6.9 New Concepts in This Chapter 177 6.10 Review Problems 178 6.11 Programming Problems 178 7 Collaboration Between Objects 181 7.1 Examples of Collaboration Between Objects 182 7.2 A Menu-Driven Program 190 7.3 Several References to the Same Object 197 7.4 Summary: Argument Transfer 202 7.5 New Concepts in This Chapter 205 7.6 Review Problems 205 7.7 Programming Problems 205 8 Java Libraries and Exception Handling 207 8.1 The Online API Documentation 208 8.2 Making Your Own Libraries 211 8.3 Localization 214 2

8.4 Sound and Images 218 8.5 Introduction to Exception Handling 220 8.6 Exception Handling in Detail 226 8.7 New Concepts in This Chapter 236 8.8 Review Problems 236 8.9 Programming Problems 237 9 Arrays of Primitive Data Types 239 9.1 What is an Array? 240 9.2 Copying Arrays 244 9.3 The Month Class for Precipitation Data 247 9.4 Sorting 251 9.5 Searching 255 9.6 The java.util.arrays Class 256 9.7 Two-Dimensional Arrays 258 9.8 More Than Two Dimensions 265 9.9 Multidimensional Arrays and Object-Oriented Programming 266 9.10 New Concepts in This Chapter 267 9.11 Review Problems 268 9.12 Programming Problems 268 10 Arrays of Reference Types and Array Lists 271 10.1 An Array of Reference Type 272 10.2 Array Lists 275 10.3 Wrapper Classes Integer, Double, etc. 278 10.4 The Methods equals() and tostring() 281 10.5 Associations 283 10.6 A Bigger Example 285 10.7 The Comparable and Comparator Interfaces 296 10.8 Sorting Arrays and Array Lists 298 10.9 New Concepts in This Chapter 304 10.10 Review Problems 305 10.11 Programming Problems 305 11 Using Data Files and Streams 307 11.1 Data Files and Streams 308 11.2 An Example of a Data File 309 11.3 Reading Text from a File 311 11.4 Writing Text to a File 315 11.5 Data Files: Summary and Class Descriptions 316 11.6 Reading Numbers from a Data File 320 11.7 Communication with the Console 323 11.8 Binary Transfer of Data 323 11.9 Random Access to the Contents of a File 325 11.10 Serialization 329 11.11 New Concepts in This Chapter 335 11.12 Review Problems 355 11.13 Programming Problems 336 12 Inheritance and Polymorphism 339 12.1 Generalization and Specialization 340 3

12.2 Inheritance 342 12.3 The Material Class with Subclasses 345 12.4 Handling Instances of Subclasses as a Whole 351 12.5 The Renovation Example with Many Surfaces and Many Materials 354 12.6 What if Polymorphism Didn t Exist? 357 12.7 The protected Access Modifier 360 12.8 Two Levels of Inheritance 364 12.9 Rules and Syntax 369 12.10 Interface 372 12.11 New Concepts in This Chapter 376 12.12 Review Problems 377 12.13 Programming Problems 378 13 GUI Programming and Events 383 13.1 GUI Components 384 13.2 Pushing a Button 388 13.3 Inner Classes 395 13.4 Managing the Layout 402 13.5 New Concepts in This Chapter 412 13.6 Review Problems 413 13.7 Programming Problems 413 14 Texts, Choices, and Windows 415 14.1 Text Components and Focus Listeners 416 14.2 Giving the User a Choice Between Alternatives 423 14.3 Choices Using Check Boxes 425 14.4 Choices Using Radio Buttons 428 14.5 Choices Using Lists 431 14.6 Windows 439 14.7 Making a Window 441 14.8 Differences Between Applets and Applications 446 14.9 Other Ways to Program Listeners 448 14.10 New Concepts in This Chapter 450 14.11 Review Problems 451 14.12 Programming Problems 451 15 Creating User Interfaces 453 15.1 Menus 453 15.2 Toolbars 458 15.3 Dialog Windows 461 15.4 GridBagLayout as Layout Manager 476 15.5 The Table GUI Component (the JTable Class) 481 15.6 GUI for the Renovation Project 484 15.7 New Concepts in This Chapter 495 15.8 Review Problems 495 15.9 Programming Problems 496 16 Threads 499 16.1 Threads in Processes 500 16.2 Dividing Time Between Threads 502 16.3 Example of Threads in Use 503 4

16.4 Thread Conditions 507 16.5 Communication Between Threads 508 16.6 Locks and Synchronization 510 16.7 More Control: wait(), notify(), and notifyall() 515 16.8 Peeking at the Threads with JDB 519 16.9 New Concepts in This Chapter 521 16.10 Review Problems 522 16.11 Programming Problem 522 17 Data Structures and Algorithms 523 17.1 Graphs 524 17.2 Lists 526 17.3 The Solution: Collection, List, and LinkedList 534 17.4 Queues and Stacks 538 17.5 Recursion 540 17.6 Trees 542 17.7 Trees in the API 550 17.8 Hashtables 553 17.9 New Concepts in This Chapter 558 17.10 Review Problems 559 17.11 Programming Problems 559 18 More about Applets 561 18.1 What Applets Do on the Web 561 18.2 Security 562 18.3 Programming an Applet 565 18.4 Security in Practice 570 18.5 Communication Between Applet and Browser 572 18.6 New Concepts in This Chapter 575 18.7 Review Problems 576 18.8 Programming Problems 576 19 Distributed Systems with Socket Programming and RMI 579 19.1 Sockets 580 19.2 Objects That Collaborate over a Network 586 19.3 How Does Communication Between the Objects Occur? 594 19.4 RMI and Applets 600 19.5 Deployment Diagram 600 19.6 A Distributed System with Callback 603 19.7 New Concepts in This Chapter 614 19.8 Review Problems 615 19.9 Programming Problems 615 20 Programming with Databases 619 20.1 Database Drivers 620 20.2 Establishing Contact with a Database 621 20.3 A Bigger Example 628 20.4 A Database Application 634 20.5 The Three-Layer Architecture 640 20.6 Transactions and Compiled SQL Statements 641 20.7 New Concepts in This Chapter 645 5

20.8 Review Problems 645 20.9 Programming Problems 646 21 Web Programming with JavaServer Pages 649 21.1 Different Ways of Programming for the Web 650 21.2 Installing Software 651 21.3 Servlets 652 21.4 JavaServer Pages (JSP) 657 21.5 What Does JSP Consist of? 658 21.6 Inputting Data from the User 662 21.7 Client-Side Validation with JavaScript 671 21.8 Databases 672 21.9 Storing State Information 680 21.10 New Concepts in This Chapter 695 21.11 Review Problems 696 21.12 Programming Problems 697 APPENDICES A Using Java SDK and WinEdit 699 A.1 SDK 699 A.2 Running Applets 703 A.3 WinEdit 703 B Keywords 705 C Number Systems 707 D The Unicode Character Set 711 E HTML and Applets 713 F Exceptions to the Code Standard 717 G References 719 Index 721 6