C ONTENTS PART I FUNDAMENTALS OF PROGRAMMING 1. and Java 3. Chapter 1 Introduction to Computers, Programs,

Similar documents
This page intentionally left blank

MyProgram m i ng Lab. get with the programming. Through the power of practice and immediate personalized

ощ 'ршорвшэш! цвн-эориэу ощ 'sajbpossv # PIPG DUJ 'ssjmoossv ^ PIPG pipa w н OX ЛЮН VAV

This page intentionally left blank

Java Fundamentals p. 1 The Origins of Java p. 2 How Java Relates to C and C++ p. 3 How Java Relates to C# p. 4 Java's Contribution to the Internet p.

Introduction to Programming Using Java (98-388)

Contents. Figures. Tables. Examples. Foreword. Preface. 1 Basics of Java Programming 1. xix. xxi. xxiii. xxvii. xxix

CONTENTS. PART 1 Structured Programming 1. 1 Getting started 3. 2 Basic programming elements 17

Big Java Late Objects

The Sun s Java Certification and its Possible Role in the Joint Teaching Material

Introduction. Assessment Test. Part I The Programmer s Exam 1

Contents. iii Copyright 1998 Sun Microsystems, Inc. All Rights Reserved. Enterprise Services August 1998, Revision B

Contents Chapter 1 Introduction to Programming and the Java Language

Supporting Materials

Foundations of object orientation

Syllabus & Curriculum for Certificate Course in Java. CALL: , for Queries

Contents. 1 Introduction to Computers, the Internet and the World Wide Web 1. 2 Introduction to C Programming 26

LTBP INDUSTRIAL TRAINING INSTITUTE

Murach s Beginning Java with Eclipse

15CS45 : OBJECT ORIENTED CONCEPTS

JAVA CONCEPTS Early Objects

Java for Programmers Course (equivalent to SL 275) 36 Contact Hours

Weiss Chapter 1 terminology (parenthesized numbers are page numbers)

1 OBJECT-ORIENTED PROGRAMMING 1

Application Development in JAVA. Data Types, Variable, Comments & Operators. Part I: Core Java (J2SE) Getting Started

PESIT Bangalore South Campus

F1 A Java program. Ch 1 in PPIJ. Introduction to the course. The computer and its workings The algorithm concept

MARS AREA SCHOOL DISTRICT Curriculum TECHNOLOGY EDUCATION

COWLEY COLLEGE & Area Vocational Technical School

GUJARAT TECHNOLOGICAL UNIVERSITY

WA1278 Introduction to Java Using Eclipse

SCHEME OF COURSE WORK


Diploma in Android Programming (DAP)

CHAPTER 1: A GENERAL INTRODUCTION TO PROGRAMMING 1

[Course Overview] After completing this module you are ready to: Develop Desktop applications, Networking & Multi-threaded programs in java.

"Charting the Course... Java Programming Language. Course Summary

Objects First with Java

Building Java Programs

Oracle 10g: Java Programming

Course Description. Learn To: : Intro to JAVA SE7 and Programming using JAVA SE7. Course Outline ::

Core Java - SCJP. Q2Technologies, Rajajinagar. Course content

SELF-STUDY. Glossary

Fast Track to Core Java 8 Programming for OO Developers (TT2101-J8) Day(s): 3. Course Code: GK1965. Overview

OracleAS 10g R3: Java Programming

Reviewing for the Midterm Covers chapters 1 to 5, 7 to 9. Instructor: Scott Kristjanson CMPT 125/125 SFU Burnaby, Fall 2013


E Oracle 10g Java Bootcamp I v1

Java SE7 Fundamentals

Page 1

Mathematics/Science Department Kirkwood Community College. Course Syllabus. Computer Science CSC142 1/10

COURSE DETAILS: CORE AND ADVANCE JAVA Core Java

Object Oriented Programming: In this course we began an introduction to programming from an object-oriented approach.

Contents. 1 Introduction to Computers, the Internet and the Web 1

Python Scripting for Computational Science

Java Programming Training for Experienced Programmers (5 Days)

Objects and Iterators

Core Java SYLLABUS COVERAGE SYLLABUS IN DETAILS

5. In JAVA, is exception handling implicit or explicit or both. Explain with the help of example java programs. [16]

A Quick Tour p. 1 Getting Started p. 1 Variables p. 3 Comments in Code p. 6 Named Constants p. 6 Unicode Characters p. 8 Flow of Control p.

Acknowledgments Introduction. Part I: Programming Access Applications 1. Chapter 1: Overview of Programming for Access 3

(800) Toll Free (804) Fax Introduction to Java and Enterprise Java using Eclipse IDE Duration: 5 days

Contributor. International Edition contributions by. Piyali Sengupta PEARSON. New York San Francisco Upper

Software Development & Education Center. Java Platform, Standard Edition 7 (JSE 7)

Language Features. 1. The primitive types int, double, and boolean are part of the AP

Introduction... xv SECTION 1: DEVELOPING DESKTOP APPLICATIONS USING JAVA Chapter 1: Getting Started with Java... 1

Java 1.8 Programming

Contents. I. Classes, Superclasses, and Subclasses. Topic 04 - Inheritance

3D Graphics Programming Mira Costa High School - Class Syllabus,

Java 8 Programming for OO Experienced Developers

SRM ARTS AND SCIENCE COLLEGE SRM NAGAR, KATTANKULATHUR

Python Scripting for Computational Science

Preface. The Purpose of this Book and Its Audience. Coverage and Approach

Absolute C++ Walter Savitch

VB.NET Web : Phone : INTRODUCTION TO NET FRAME WORK

CORE JAVA TRAINING COURSE CONTENT

SYLLABUS JAVA COURSE DETAILS. DURATION: 60 Hours. With Live Hands-on Sessions J P I N F O T E C H

Java Software Solutions Foundations of Program Design

Chapter 4 Defining Classes I

Subclass Gist Example: Chess Super Keyword Shadowing Overriding Why? L10 - Polymorphism and Abstract Classes The Four Principles of Object Oriented

ITT Technical Institute. SD1420 Introduction to Java Programming Onsite Course SYLLABUS

Index. Index. More information. block statements 66 y 107 Boolean 107 break 55, 68 built-in types 107

Java for Non Majors. Final Study Guide. April 26, You will have an opportunity to earn 20 extra credit points.

Week. Lecture Topic day (including assignment/test) 1 st 1 st Introduction to Module 1 st. Practical

VALLIAMMAI ENGINEERING COLLEGE

Intro: Your brain on Java Who is this book for? What your brain is thinking. Bend your brain into submission What you need for this book

Object Oriented Programming with Java. Unit-1

Java Programming Course Overview. Duration: 35 hours. Price: $900

Java SE 7 Programming

Java for Non Majors Spring 2018

C# Programming: From Problem Analysis to Program Design. Fourth Edition

DHANALAKSHMI SRINIVASAN COLLEGE OF ENGINEERING AND TECHNOLOGY ACADEMIC YEAR (ODD SEM)

JAVA. Duration: 2 Months

Programming in Scala Second Edition

CO Java SE 8: Fundamentals

Syllabus- Java + Android. Java Fundamentals

Core JAVA Training Syllabus FEE: RS. 8000/-

Discover how to get up and running with the Java Development Environment and with the Eclipse IDE to create Java programs.

Objective Questions. BCA Part III Paper XIX (Java Programming) page 1 of 5

CONTENTS. Chapter 1 Getting Started with Java SE 6 1. Chapter 2 Exploring Variables, Data Types, Operators and Arrays 13

Transcription:

C ONTENTS PART I FUNDAMENTALS OF PROGRAMMING 1 Chapter 1 Introduction to Computers, Programs, and Java 3 1.1 Introduction 4 1.2 What Is acomputer? 4 1.3 Programs 7 1.4 Operating Systems 9 1.5 Number Systems (Optional) 10 1.6 Java,World Wide Web, and Beyond 13 1.7 Characteristics of Java (Optional) 16 1.8 The Java Language Specification, API, JDK, and IDE 19 1.9 ASimple Java Program 20 1.10 Creating, Compiling, and Executing ajavaprogram 21 1.11 Anatomy of the Java Program 23 1.12 Displaying Text in amessage Dialog Box 25 Chapter 2 Primitive Data Types and Operations 32 2.1 Introduction 33 2.2 Writing Simple Programs 33 2.3 Identifiers 35 2.4 Variables 36 2.5 Assignment Statements and Assignment Expressions 37 2.6 Constants 38 2.7 Numeric Data Types and Operations 39 2.8 Numeric Type Conversions 44 2.9 Character Data Type and Operations 45 2.10 boolean Data Type and Operations 47 2.11 Operator Precedence and Associativity 50 2.12 Operand Evaluation Order 51 2.13 The String Type 52 2.14 Getting Input from Input Dialogs 53 2.15 Case Studies 56 xvi

Contents xvii 2.16 Getting Input from the Console (Optional) 63 2.17 Formatting Output (JDK 1.5 Feature) 64 2.18 Programming Style and Documentation 66 2.19 Programming Errors 68 2.20 Debugging 69 Chapter 3 Control Statements 80 3.1 Introduction 81 3.2 Selection Statements 81 3.3 Loop Statements 91 3.5 Which Loop to Use? 100 3.6 Using the Keywords break and continue 101 3.7 Case Studies 104 Chapter 4 Methods 125 4.1 Introduction 126 4.2 Creating amethod 126 4.3 Calling amethod 127 4.4 Passing Parameters by Values 130 4.5 Overloading Methods 133 4.6 The Scope of Local Variables 137 4.7 Method Abstraction 138 4.8 The Math Class 138 4.9 Case Study: Generating Random Characters 141 4.10 Stepwise Refinement (Optional) 143 4.11 Recursion (Optional) 149 4.12 Packages (Optional) 159 Chapter 5 Arrays 175 5.1 Introduction 176 5.2 Array Basics 176 5.3 Copying Arrays 183 5.4 Passing Arrays to Methods 184 5.5 Returning an Array from amethod 188 5.6 Sorting Arrays 191 5.7 Searching Arrays 193 5.8 Multidimensional Arrays 196

xviii Contents PART II OBJECT-ORIENTED PROGRAMMING 211 Chapter 6 Objects and Classes 213 6.1 Introduction 214 6.2 Defining Classes for Objects 214 6.3 Constructing Objects Using Constructors 215 6.4 Accessing Objects via Reference Variables 216 6.5 Using Classes from the Java Library 222 6.6 Visibility Modifiers, Accessors, and Mutators 223 6.7 Data Field Encapsulation 225 6.8 Immutable Objects and Classes 227 6.9 Passing Objects to Methods 228 6.10 Static Variables, Constants, and Methods 229 6.11 The Scope of Variables 233 6.12 The this Keyword 234 6.13 Array of Objects 235 6.14 Class Abstraction and Encapsulation 238 6.15 Case Study: The Loan Class 238 6.16 Case Study: The StackOfIntegers Class (Optional) 242 6.17 Inner Classes 245 Chapter 7 Strings 257 7.1 Introduction 258 7.2 The String Class 258 7.3 The Character Class 267 7.4 The StringBuffer Class 270 7.5 The StringTokenizer Class 274 7.6 The Scanner Class (JDK 1.5 Feature) 276 7.7 Implementing MyInput Using Scanner 276 7.8 Command-Line Arguments 278 Chapter 8 Inheritance and Polymorphism 287 8.1 Introduction 288 8.2 Superclasses and Subclasses 288 8.3 Using the Keyword super 289 8.4 Overriding Methods 291 8.5 The Object class 293 8.6 Polymorphism, Dynamic Binding, and Generic Programming 294

Contents xix 8.7 Casting Objects and the instanceof Operator 296 8.8 Hiding Data Fields and Static Methods (Optional) 299 8.9 The protected Data and Methods 301 8.10 The final Classes, Methods, and Variables 302 8.11 The finalize, clone,and getclass Methods (Optional) 302 8.12 Initialization Blocks (Optional) 305 Chapter 9 Abstract Classes and Interfaces 315 9.1 Introduction 316 9.2 Abstract Classes 316 9.3 The Calendar and GregorianCalendar classes 322 9.4 Interfaces 323 9.5 Processing PrimitiveData Type Values as Objects 331 9.6 Automatic Conversion Between PrimitiveTypes and Wrapper Class Types (JDK 1.5 Feature) 336 Chapter 10 Object-Oriented Modeling 343 10.1 Introduction 344 10.2 The SoftwareDevelopment Process 344 10.3 Discovering Relationships Among Classes 345 10.4 Case Study: AClass Design Example 348 10.5 Case Study: The Rational Class 353 10.6 Class Design Guidelines 358 10.7 Modeling Dynamic Behavior Using Sequence Diagrams and Statecharts (Optional) 360 10.8 Framework-Based Programming Using Java API 362 PART III GUI PROGRAMMING 367 Chapter 11 Getting Started with GUI Programming 369 11.1 Introduction 370 11.2 GUI Components 370 11.3 The Java GUI API 371 11.4 Frames 374 11.5 Layout Managers 377 11.6 The Color Class 384 11.7 The Font Class 385 11.8 Using Panels as Subcontainers 386 11.9 Drawing Graphics on Panels 388

xx Contents 11.10 Centering adisplay Using the FontMetrics Class 398 11.11 Case Studies: The MessagePanel Class 400 11.12 Case Studies: The StillClock Class (Optional) 404 Chapter 12 Event-Driven Programming 419 12.1 Introduction 420 12.2 Event and Event Source 420 12.3 Listeners, Registrations, and Handling Events 421 12.4 Mouse Events 430 12.5 KeyboardEvents 435 12.6 The Timer Class (Optional) 438 Chapter 13 Creating User Interfaces 446 13.1 Introduction 447 13.2 Common Features of Swing GUI Components 447 13.3 Buttons 449 13.4 Check Boxes 457 13.5 Radio Buttons 460 13.6 Labels 463 13.7 Text Fields 464 13.8 Text Areas 466 13.9 Combo Boxes 470 13.10 Lists 473 13.11 Scroll Bars 476 13.12 Sliders 479 13.13 Creating Multiple Windows 482 Chapter 14 Applets, Images, and Audio 497 14.1 Introduction 498 14.2 The Applet Class 498 14.3 The JApplet Class 500 14.4 The HTML File and the <applet> Tag 501 14.5 Passing Strings to Applets 506 14.6 Enabling Applets to RunasApplications 508 14.7 Case Study: TicTacToe (Optional) 512 14.8 Case Study: Bouncing Ball (Optional) 516 14.8 The URL Class (Optional) 519 14.9 Displaying Images (Optional) 520 14.10 Case Study: The ImageViewer Component 522 14.11 Case Study: The Image Animations (Optional) 526

Contents xxi 14.12 Playing Audio 528 14.13 Packaging and Deploying Java Projects (Optional) 530 14.14 Pluggable Look-and-Feel (Optional) 533 PART IV EXCEPTION HANDLING AND IO 547 Chapter 15 Exceptions and Assertions 549 15.1 Introduction 550 15.2 Exceptions and Exception Types 550 15.3 Understanding Exception Handling 553 15.4 Rethrowing Exceptions 561 15.5 The finally Clause 561 15.6 When to UseExceptions 562 15.7 Creating Custom Exception Classes (Optional) 562 15.8 Assertions 563 Chapter 16 Simple Input and Output 572 16.1 Introduction 573 16.2 The File Class 573 16.3 HowisI/O Handled in Java? 575 16.4 Text I/O 578 16.5 Case Study: Text Viewer 585 16.6 BinaryI/O 587 16.7 Case Study: Copy File 593 16.8 More on Text Files and BinaryFiles 595 16.9 Object I/O (Optional) 596 16.10 Random Access Files (Optional) 600 16.11 Case Study: Address Book (Optional) 603

A PPENDIXES 1163 Appendix A Java Keywords 1165 Appendix B The ASCII Character Set 1166 Appendix C Operator Precedence Chart 1168 Appendix D Java Modifiers 1170 Appendix E UML Graphical Notations 1171 Classes and Objects 1171 The Modifiers public, private, protected,and static 1172 Class Relationships 1172 Abstract Classes and Interfaces 1173 Sequence Diagrams 1173 StatechartDiagrams 1173 Appendix F Special Floating-Point Values 1175 Appendix G Bit Operations 1176 Index 1177