100% found this document useful (2 votes)
25 views

Introduction to Java Programming, Comprehensive Version 10th edition- eBook PDF 2024 Scribd Download

The document promotes various Java programming eBooks available for download on ebookluna.com, including comprehensive and brief versions of 'Introduction to Java Programming' and other related titles. It highlights the features of the 10th edition of 'Introduction to Java Programming,' which includes updated content, enhanced pedagogical features, and a focus on problem-solving. The book is designed to teach programming fundamentals and advanced concepts through a practical, example-driven approach.

Uploaded by

treciaibnu
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (2 votes)
25 views

Introduction to Java Programming, Comprehensive Version 10th edition- eBook PDF 2024 Scribd Download

The document promotes various Java programming eBooks available for download on ebookluna.com, including comprehensive and brief versions of 'Introduction to Java Programming' and other related titles. It highlights the features of the 10th edition of 'Introduction to Java Programming,' which includes updated content, enhanced pedagogical features, and a focus on problem-solving. The book is designed to teach programming fundamentals and advanced concepts through a practical, example-driven approach.

Uploaded by

treciaibnu
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 50

Get the full ebook with Bonus Features for a Better Reading Experience on ebookluna.

com

Introduction to Java Programming, Comprehensive


Version 10th edition- eBook PDF

https://ebookluna.com/download/introduction-to-java-
programming-comprehensive-version-ebook-pdf/

OR CLICK HERE

DOWLOAD NOW

Download more ebook instantly today at https://ebookluna.com


Instant digital products (PDF, ePub, MOBI) ready for you
Download now and discover formats that fit your needs...

(eBook PDF) Introduction to JAVA Programming and Data


Structures Comprehensive Version 11

https://ebookluna.com/product/ebook-pdf-introduction-to-java-
programming-and-data-structures-comprehensive-version-11/

ebookluna.com

(eBook PDF) Introduction to Java Programming and Data


Structures, Comprehensive Version, 11th Global Edition

https://ebookluna.com/product/ebook-pdf-introduction-to-java-
programming-and-data-structures-comprehensive-version-11th-global-
edition/
ebookluna.com

(eBook PDF) Introduction to Java Programming, Brief


Version, Global Edition 11th Edition

https://ebookluna.com/product/ebook-pdf-introduction-to-java-
programming-brief-version-global-edition-11th-edition/

ebookluna.com

(eBook PDF) Java: An Introduction to Problem Solving and


Programming 7th Edition

https://ebookluna.com/product/ebook-pdf-java-an-introduction-to-
problem-solving-and-programming-7th-edition/

ebookluna.com
(eBook PDF) Java: An Introduction to Problem Solving and
Programming 8th Edition

https://ebookluna.com/product/ebook-pdf-java-an-introduction-to-
problem-solving-and-programming-8th-edition/

ebookluna.com

(eBook PDF) Introduction to Programming with Java: A


Problem Solving Approach 3rd Edition

https://ebookluna.com/product/ebook-pdf-introduction-to-programming-
with-java-a-problem-solving-approach-3rd-edition/

ebookluna.com

(eBook PDF) Introduction to Programming Using Visual Basic


10th Edition

https://ebookluna.com/product/ebook-pdf-introduction-to-programming-
using-visual-basic-10th-edition/

ebookluna.com

Java Programming (MindTap Course List), 10th Edition Joyce


Farrell - eBook PDF

https://ebookluna.com/download/java-programming-mindtap-course-
list-10th-edition-ebook-pdf/

ebookluna.com

Java Programming 9th Edition Joyce Farrell - eBook PDF

https://ebookluna.com/download/java-programming-ebook-pdf/

ebookluna.com
INTRODUCTION TO

JAVA
®

PROGRAMMING
COMPREHENSIVE VERSION

Tenth Edition

Y. Daniel Liang
Armstrong Atlantic State University

Boston Columbus Indianapolis New York San Francisco Upper Saddle River
Amsterdam Cape Town Dubai London Madrid Milan Munich Paris Montreal Toronto
Delhi Mexico City Sao Paulo Sydney Hong Kong Seoul Singapore Taipei Tokyo
To Samantha, Michael, and Michelle

Editorial Director, ECS: Marcia Horton Cover Designer: Marta Samsel


Executive Editor: Tracy Johnson (Dunkelberger) Permissions Supervisor: Michael Joyce
Editorial Assistant: Jenah Blitz-Stoehr Permissions Administrator: Jenell Forschler
Director of Marketing: Christy Lesko Director, Image Asset Services: Annie Atherton
Marketing Manager: Yez Alayan Manager, Visual Research: Karen Sanatar
Marketing Assistant: Jon Bryant Image Permission Coordinator:
Director of Program Management: Erin Gregg Cover Art: © Blend Images—PBNJ Productions/Getty
Program Management-Team Lead: Scott Disanno Images
Program Manager: Carole Snyder Media Project Manager: Renata Butera
Project Management-Team Lead: Laura Burgess Full-Service Project Management: Haseen Khan,
Project Manager: Robert Engelhardt Laserwords Pvt Ltd
Procurement Specialist: Linda Sager

Credits and acknowledgments borrowed from other sources and reproduced, with permission, in this textbook
appear on the appropriate page within text.

Microsoft® and Windows® are registered trademarks of the Microsoft Corporation in the U.S.A. and other
countries. Screen shots and icons reprinted with permission from the Microsoft Corporation. This book is not
sponsored or endorsed by or affiliated with the Microsoft Corporation.

Copyright © 2015, 2013, 2011 Pearson Education, Inc., publishing as Prentice Hall, 1 Lake Street, Upper Saddle
River, New Jersey, 07458. All rights reserved. Printed in the United States of America. This publication is protected
by Copyright, and permission should be obtained from the publisher prior to any prohibited reproduction, storage in
a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording,
or likewise. To obtain permission(s) to use material from this work, please submit a written request to Pearson
Education, Inc., Permissions Department, One Lake Street, Upper Saddle River, New Jersey 07458, or you may fax
your request to 201-236-3290.

Many of the designations by manufacturers and sellers to distinguish their products are claimed as trademarks.
Where those designations appear in this book, and the publisher was aware of a trademark claim, the designations
have been printed in initial caps or all caps.

Library of Congress Cataloging-in-Publication Data available upon request.

10 9 8 7 6 5 4 3 2 1

ISBN 10: 0-13-376131-2


ISBN 13: 978-0-13-376131-3
PREFACE
Dear Reader,

Many of you have provided feedback on earlier editions of this book, and your comments and
suggestions have greatly improved the book. This edition has been substantially enhanced in
presentation, organization, examples, exercises, and supplements. The new edition:
■ Replaces Swing with JavaFX. JavaFX is a new framework for developing Java GUI pro- what is new?
grams. JavaFX greatly simplifies GUI programming and is easier to learn than Swing.
■ Introduces exception handling, abstract classes, and interfaces before GUI programming to
enable the GUI chapters to be skipped completely if the instructor chooses not to cover GUI.
■ Covers introductions to objects and strings earlier in Chapter 4 to enable students to use
objects and strings to develop interesting programs early.
■ Includes many new interesting examples and exercises to stimulate student interests. More
than 100 additional programming exercises are provided to instructors only on the Com-
panion Website.
Please visit www.pearsonhighered.com/liang for a complete list of new features as well as
correlations to the previous edition.
The book is fundamentals first by introducing basic programming concepts and techniques fundamentals-first
before designing custom classes. The fundamental concepts and techniques of selection
statements, loops, methods, and arrays are the foundation for programming. Building this
strong foundation prepares students to learn object-oriented programming and advanced Java
programming.
This book teaches programming in a problem-driven way that focuses on problem solv- problem-driven
ing rather than syntax. We make introductory programming interesting by using thought-
provoking problems in a broad context. The central thread of early chapters is on problem
solving. Appropriate syntax and library are introduced to enable readers to write programs for
solving the problems. To support the teaching of programming in a problem-driven way, the
book provides a wide variety of problems at various levels of difficulty to motivate students.
To appeal to students in all majors, the problems cover many application areas, including
math, science, business, financial, gaming, animation, and multimedia.
The book seamlessly integrates programming, data structures, and algorithms into one text. data structures
It employs a practical approach to teach data structures. We first introduce how to use various
data structures to develop efficient algorithms, and then show how to implement these data
structures. Through implementation, students gain a deep understanding on the efficiency of
data structures and on how and when to use certain data structures. Finally we design and
implement custom data structures for trees and graphs.
The book is widely used in the introductory programming, data structures, and algorithms
courses in the universities around the world. This comprehensive version covers fundamentals comprehensive version
of programming, object-oriented programming, GUI programming, data structures, algorithms,
concurrency, networking, database, and Web programming. It is designed to prepare students
to become proficient Java programmers. A brief version (Introduction to Java Programming, brief version
Brief Version, Tenth Edition) is available for a first course on programming, commonly known AP Computer Science
as CS1. The brief version contains the first 18 chapters of the comprehensive version. The first
13 chapters are appropriate for preparing the AP Computer Science exam.
The best way to teach programming is by example, and the only way to learn program- examples and exercises
ming is by doing. Basic concepts are explained by example and a large number of exercises

iii
iv Preface
with various levels of difficulty are provided for students to practice. For our programming
courses, we assign programming exercises after each lecture.
Our goal is to produce a text that teaches problem solving and programming in a broad
context using a wide variety of interesting examples. If you have any comments on and sug-
gestions for improving the book, please email me.
Sincerely,

Y. Daniel Liang
[email protected]
www.cs.armstrong.edu/liang
www.pearsonhighered.com/liang

ACM/IEEE Curricular 2013 and ABET


Course Assessment
The new ACM/IEEE Computer Science Curricular 2013 defines the Body of Knowledge
organized into 18 Knowledge Areas. To help instructors design the courses based on this book,
we provide sample syllabi to identify the Knowledge Areas and Knowledge Units. The sample
syllabi are for a three semester course sequence and serve as an example for institutional cus-
tomization. The sample syllabi are available to instructors at www.pearsonhighered.com/liang.
Many of our users are from the ABET-accredited programs. A key component of the ABET
accreditation is to identify the weakness through continuous course assessment against the course
outcomes. We provide sample course outcomes for the courses and sample exams for measuring
course outcomes on the instructor Website accessible from www.pearsonhighered.com/liang.

What’s New in This Edition?


This edition is completely revised in every detail to enhance clarity, presentation, content,
examples, and exercises. The major improvements are as follows:
■ Updated to Java 8.
■ Since Swing is replaced by JavaFX, all GUI examples and exercises are revised using
JavaFX.
■ Lambda expressions are used to simplify coding in JavaFX and threads.
■ More than 100 additional programming exercises with solutions are provided to the
instructor on the Companion Website. These exercises are not printed in the text.
■ Math methods are introduced earlier in Chapter 4 to enable students to write code using
math functions.
■ Strings are introduced earlier in Chapter 4 to enable students to use objects and strings to
develop interesting programs early.
■ The GUI chapters are moved to after abstract classes and interfaces so that these chapters
can be easily skipped if the instructor chooses not to cover GUI.
■ Chapters 4, 14, 15, and 16 are brand new chapters.
■ Chapters 28 and 29 have been substantially revised with simpler implementations for min-
imum spanning trees and shortest paths.
Preface v

Pedagogical Features
The book uses the following elements to help students get the most from the material:
■ The Objectives at the beginning of each chapter list what students should learn from the
chapter. This will help them determine whether they have met the objectives after completing
the chapter.
■ The Introduction opens the discussion with representative problems to give the reader an
overview of what to expect from the chapter.
■ Key Points highlight the important concepts covered in each section.
■ Check Points provide review questions to help students track their progress as they read
through the chapter and evaluate their learning.
■ Problems and Case Studies, carefully chosen and presented in an easy-to-follow style,
teach problem solving and programming concepts. The book uses many small, simple, and
stimulating examples to demonstrate important ideas.
■ The Chapter Summary reviews the important subjects that students should under-
stand and remember. It helps them reinforce the key concepts they have learned in the
chapter.
■ Quizzes are accessible online, grouped by sections, for students to do self-test on pro-
gramming concepts and techniques.
■ Programming Exercises are grouped by sections to provide students with opportunities
to apply the new skills they have learned on their own. The level of difficulty is rated as
easy (no asterisk), moderate (*), hard (**), or challenging (***). The trick of learning
programming is practice, practice, and practice. To that end, the book provides a great
many exercises. Additionally, more than 100 programming exercises with solutions are
provided to the instructors on the Companion Website. These exercises are not printed in
the text.
■ Notes, Tips, Cautions, and Design Guides are inserted throughout the text to offer valu-
able advice and insight on important aspects of program development.

Note
Provides additional information on the subject and reinforces important concepts.

Tip
Teaches good programming style and practice.

Caution
Helps students steer away from the pitfalls of programming errors.

Design Guide
Provides guidelines for designing programs.

Flexible Chapter Orderings


The book is designed to provide flexible chapter orderings to enable GUI, exception handling,
recursion, generics, and the Java Collections Framework to be covered earlier or later. The
diagram on the next page shows the chapter dependencies.
vi Preface
Part I: Fundamentals of Part II: Object-Oriented Part III: GUI Programming Part IV: Data Structures and Part V: Advanced Java
Programming Programming Algorithms Ch 16 Programming
Chapter 1 Introduction to Chapter 9 Objects and Classes Chapter 14 JavaFX Basics Ch 7 Chapter 18 Recursion Chapter 30 Multithreading and
Computers, Programs, and Parallel Programming
Java
Chapter 10 Thinking in Objects Chapter 15 Event-Driven Ch 13 Chapter 19 Generics
Programming and Chapter 31 Networking
Chapter 2 Elementary Animations
Chapter 11 Inheritance and Chapter 20 Lists, Stacks, Queues,
Programming
Polymorphism and Priority Queues Chapter 32 Java Database
Chapter 16 JavaFX Controls Programming
Chapter 3 Selections and Multimedia
Chapter 12 Exception Chapter 21 Sets and Maps
Handling and Text I/O Chapter 33 JavaServer Faces
Chapter 4 Mathematical Chapter 34 Advanced GUI Chapter 22 Developping
Functions, Characters, Chapter 13 Abstract Classes Programming Efficient Algorithms
and Strings and Interfaces Chapter 35 Advanced Database
Programming
Chapter 23 Sorting
Chapter 5 Loops Chapter 17 Binary I/O

Chapter 24 Implementing Lists, Chapter 36 Internationalization


Chapter 6 Methods Stacks, Queues, and Priority
Queues

Chapter 7 Single-Dimensional Chapter 37 Servlets


Arrays Chapter 25 Binary Search Trees

Note: Chapters 1–18 are in the Chapter 38 JavaServer Pages


Chapter 8 Multidimensional Chapter 26 AVL Trees
brief version of this book.
Arrays
Note: Chapters 1–33 are in the Chapter 27 Hashing Chapter 39 Web Services
comprehensive version.

Note: Chapters 34–42 are bonus Chapter 28 Graphs and


chapters available from the Applications
Companion Website.
Chapter 29 Weighted Graphs
and Applications

Chapter 40 2-4 Trees and B-


Trees

Chapter 41 Red-Black Trees Ch 9 Chapter 42 Testing Using JUnit


Preface vii

Organization of the Book


The chapters can be grouped into five parts that, taken together, form a comprehensive introduc-
tion to Java programming, data structures and algorithms, and database and Web programming.
Because knowledge is cumulative, the early chapters provide the conceptual basis for under-
standing programming and guide students through simple examples and exercises; subsequent
chapters progressively present Java programming in detail, culminating with the development
of comprehensive Java applications. The appendixes contain a mixed bag of topics, including an
introduction to number systems, bitwise operations, regular expressions, and enumerated types.

Part I: Fundamentals of Programming (Chapters 1–8)


The first part of the book is a stepping stone, preparing you to embark on the journey of learning
Java. You will begin to learn about Java (Chapter 1) and fundamental programming techniques
with primitive data types, variables, constants, assignments, expressions, and operators (Chapter 2),
selection statements (Chapter 3), mathematical functions, characters, and strings (Chapter 4), loops
(Chapter 5), methods (Chapter 6), and arrays (Chapters 7–8). After Chapter 7, you can jump to
Chapter 18 to learn how to write recursive methods for solving inherently recursive problems.

Part II: Object-Oriented Programming (Chapters 9–13, and 17)


This part introduces object-oriented programming. Java is an object-oriented programming
language that uses abstraction, encapsulation, inheritance, and polymorphism to provide
great flexibility, modularity, and reusability in developing software. You will learn program-
ming with objects and classes (Chapters 9–10), class inheritance (Chapter 11), polymorphism
(Chapter 11), exception handling (Chapter 12), abstract classes (Chapter 13), and interfaces
(Chapter 13). Text I/O is introduced in Chapter 12 and binary I/O is discussed in Chapter 17.

Part III: GUI Programming (Chapters 14–16 and Bonus Chapter 34)
JavaFX is a new framework for developing Java GUI programs. It is not only useful for
developing GUI programs, but also an excellent pedagogical tool for learning object-oriented
programming. This part introduces Java GUI programming using JavaFX in Chapters 14–16.
Major topics include GUI basics (Chapter 14), container panes (Chapter 14), drawing shapes
(Chapter 14), event-driven programming (Chapter 15), animations (Chapter 15), and GUI
controls (Chapter 16), and playing audio and video (Chapter 16). You will learn the architec-
ture of JavaFX GUI programming and use the controls, shapes, panes, image, and video to
develop useful applications. Chapter 34 covers advanced features in JavaFX.

Part IV: Data Structures and Algorithms (Chapters 18–29 and Bonus Chapters 40–41)
This part covers the main subjects in a typical data structures and algorithms course. Chapter 18
introduces recursion to write methods for solving inherently recursive problems. Chapter 19
presents how generics can improve software reliability. Chapters 20 and 21 introduce the
Java Collection Framework, which defines a set of useful API for data structures. Chapter 22
discusses measuring algorithm efficiency in order to choose an appropriate algorithm for
applications. Chapter 23 describes classic sorting algorithms. You will learn how to implement
several classic data structures lists, queues, and priority queues in Chapter 24. Chapters 25 and
26 introduce binary search trees and AVL trees. Chapter 27 presents hashing and implement-
ing maps and sets using hashing. Chapters 28 and 29 introduce graph applications. The 2-4
trees, B-trees, and red-black trees are covered in Bonus Chapters 40–41.

Part V: Advanced Java Programming (Chapters 30–33 and Bonus Chapters 35–39, 42)
This part of the book is devoted to advanced Java programming. Chapter 30 treats the use
of multithreading to make programs more responsive and interactive and introduces parallel
programming. Chapter 31 discusses how to write programs that talk with each other from
different hosts over the Internet. Chapter 32 introduces the use of Java to develop database
viii Preface
projects. Chapter 33 introduces modern Web application development using JavaServer Faces.
Chapter 35 delves into advanced Java database programming. Chapter 36 covers the use of
internationalization support to develop projects for international audiences. Chapters 37 and
38 introduce how to use Java servlets and JavaServer Pages to generate dynamic content from
Web servers. Chapter 39 discusses Web services. Chapter 42 introduces testing Java programs
using JUnit.

Appendixes
This part of the book covers a mixed bag of topics. Appendix A lists Java keywords.
Appendix B gives tables of ASCII characters and their associated codes in decimal and in
hex. Appendix C shows the operator precedence. Appendix D summarizes Java modifiers and
their usage. Appendix E discusses special floating-point values. Appendix F introduces num-
ber systems and conversions among binary, decimal, and hex numbers. Finally, Appendix G
introduces bitwise operations. Appendix H introduces regular expressions. Appendix I covers
enumerated types.

Java Development Tools


You can use a text editor, such as the Windows Notepad or WordPad, to create Java programs
and to compile and run the programs from the command window. You can also use a Java
development tool, such as NetBeans or Eclipse. These tools support an integrated develop-
ment environment (IDE) for developing Java programs quickly. Editing, compiling, building,
executing, and debugging programs are integrated in one graphical user interface. Using these
tools effectively can greatly increase your programming productivity. NetBeans and Eclipse
IDE tutorials are easy to use if you follow the tutorials. Tutorials on NetBeans and Eclipse can be found
under Tutorials on the Student Companion Website at www.pearsonhighered.com/liang.

Student Resource Website


The Student Resource Website www.pearsonhighered.com/liang provides access to some of the
following resources. Other resources are available using the student access code printed on the
inside front cover of this book. (For students with a used copy of this book, you can purchase
access to the premium student resources through www.pearsonhighered.com/liang.)
■ Answers to review questions
■ Solutions to even-numbered programming exercises
■ Source code for the examples in the book
■ Interactive quiz (organized by sections for each chapter)
■ Supplements
■ Debugging tips
■ Algorithm animations
■ Errata

Instructor Resource Website


The Instructor Resource Website, accessible from www.pearsonhighered.com/liang, provides
access to the following resources:
■ Microsoft PowerPoint slides with interactive buttons to view full-color, syntax-highlighted
source code and to run programs without leaving the slides.
■ Solutions to all programming exercises. Students will have access to the solutions of even-
numbered programming exercises.
Preface ix
■ More than 100 additional programming exercises organized by chapters. These exercises
are available only to the instructors. Solutions to these exercises are provided.
■ Web-based quiz generator. (Instructors can choose chapters to generate quizzes from a
large database of more than two thousand questions.)
■ Sample exams. Most exams have four parts:
■ Multiple-choice questions or short-answer questions
■ Correct programming errors
■ Trace programs
■ Write programs
■ ACM/IEEE Curricula 2013. The new ACM/IEEE Computer Science Curricula 2013
defines the Body of Knowledge organized into 18 Knowledge Areas. To help instructors
design the courses based on this book, we provide sample syllabi to identify the Knowl-
edge Areas and Knowledge Units. The sample syllabi are for a three semester course
sequence and serve as an example for institutional customization. Instructors can access
the syllabi at www.pearsonhighered.com/liang.
■ Sample exams with ABET course assessment.
■ Projects. In general, each project gives a description and asks students to analyze, design,
and implement the project.
Some readers have requested the materials from the Instructor Resource Website. Please
understand that these are for instructors only. Such requests will not be answered.

Online Practice and Assessment


with MyProgrammingLab
MyProgrammingLab helps students fully grasp the logic, semantics, and syntax of pro-
gramming. Through practice exercises and immediate, personalized feedback, MyProgram-
mingLab improves the programming competence of beginning students who often struggle
with the basic concepts and paradigms of popular high-level programming languages.
A self-study and homework tool, a MyProgrammingLab course consists of hundreds of
small practice problems organized around the structure of this textbook. For students, the sys-
tem automatically detects errors in the logic and syntax of their code submissions and offers
targeted hints that enable students to figure out what went wrong—and why. For instructors,
a comprehensive gradebook tracks correct and incorrect answers and stores the code inputted
by students for review.
MyProgrammingLab is offered to users of this book in partnership with Turing’s Craft, the
makers of the CodeLab interactive programming exercise system. For a full demonstration,
to see feedback from instructors and students, or to get started using MyProgrammingLab in
your course, visit www.myprogramminglab.com.

VideoNotes
We are excited about the new VideoNotes feature that is found in this new edition. These VideoNote

videos provide additional help by presenting examples of key topics and showing how to
solve problems completely, from design through coding. VideoNotes are available from
www.pearsonhighered.com/liang.
x Preface

Algorithm Animations
Animation We have provided numerous animations for algorithms. These are valuable pedagogical tools
to demonstrate how algorithms work. Algorithm animations can be accessed from the Com-
panion Website.

Acknowledgments
I would like to thank Armstrong Atlantic State University for enabling me to teach what I
write and for supporting me in writing what I teach. Teaching is the source of inspiration for
continuing to improve the book. I am grateful to the instructors and students who have offered
comments, suggestions, bug reports, and praise.
This book has been greatly enhanced thanks to outstanding reviews for this and previous
editions. The reviewers are: Elizabeth Adams (James Madison University), Syed Ahmed (North
Georgia College and State University), Omar Aldawud (Illinois Institute of Technology), Stefan
Andrei (Lamar University), Yang Ang (University of Wollongong, Australia), Kevin Bierre
(Rochester Institute of Technology), David Champion (DeVry Institute), James Chegwidden
(Tarrant County College), Anup Dargar (University of North Dakota), Charles Dierbach (Towson
University), Frank Ducrest (University of Louisiana at Lafayette), Erica Eddy (University of
Wisconsin at Parkside), Deena Engel (NewYork University), Henry A. Etlinger (Rochester Institute
of Technology), James Ten Eyck (Marist College), Myers Foreman (Lamar University), Olac
Fuentes (University of Texas at El Paso), Edward F. Gehringer (North Carolina State University),
Harold Grossman (Clemson University), Barbara Guillot (Louisiana State University), Stuart
Hansen (University of Wisconsin, Parkside), Dan Harvey (Southern Oregon University), Ron
Hofman (Red River College, Canada), Stephen Hughes (Roanoke College), Vladan Jovanovic
(Georgia Southern University), Edwin Kay (Lehigh University), Larry King (University of
Texas at Dallas), Nana Kofi (Langara College, Canada), George Koutsogiannakis (Illinois
Institute of Technology), Roger Kraft (Purdue University at Calumet), Norman Krumpe (Miami
University), Hong Lin (DeVry Institute), Dan Lipsa (Armstrong Atlantic State University),
James Madison (Rensselaer Polytechnic Institute), Frank Malinowski (Darton College),
Tim Margush (University of Akron), Debbie Masada (Sun Microsystems), Blayne Mayfield
(Oklahoma State University), John McGrath (J.P. McGrath Consulting), Hugh McGuire (Grand
Valley State), Shyamal Mitra (University of Texas at Austin), Michel Mitri (James Madison
University), Kenrick Mock (University of Alaska Anchorage), Frank Murgolo (California
State University, Long Beach), Jun Ni (University of Iowa), Benjamin Nystuen (University of
Colorado at Colorado Springs), Maureen Opkins (CA State University, Long Beach), Gavin
Osborne (University of Saskatchewan), Kevin Parker (Idaho State University), Dale Parson
(Kutztown University), Mark Pendergast (Florida Gulf Coast University), Richard Povinelli
(Marquette University), Roger Priebe (University of Texas at Austin), Mary Ann Pumphrey (De
Anza Junior College), Pat Roth (Southern Polytechnic State University), Amr Sabry (Indiana
University), Ben Setzer (Kennesaw State University), Carolyn Schauble (Colorado State
University), David Scuse (University of Manitoba), Ashraf Shirani (San Jose State University),
Daniel Spiegel (Kutztown University), Joslyn A. Smith (Florida Atlantic University), Lixin
Tao (Pace University), Ronald F. Taylor (Wright State University), Russ Tront (Simon Fraser
University), Deborah Trytten (University of Oklahoma), Michael Verdicchio (Citadel), Kent
Vidrine (George Washington University), and Bahram Zartoshty (California State University
at Northridge).
It is a great pleasure, honor, and privilege to work with Pearson. I would like to thank Tracy
Johnson and her colleagues Marcia Horton, Yez Alayan, Carole Snyder, Scott Disanno, Bob
Engelhardt, Haseen Khan, and their colleagues for organizing, producing, and promoting this
project.
As always, I am indebted to my wife, Samantha, for her love, support, and encouragement.
BRIEF CONTENTS
1 Introduction to Computers, Programs, 29 Weighted Graphs and Applications 1061
and Java 1 30 Multithreading and Parallel Programming 1097
2 Elementary Programming 33 31 Networking 1139
3 Selections 75 32 Java Database Programming 1173
4 Mathematical Functions, Characters, 33 JavaServer Faces 1213
and Strings 119
5 Loops 157
6 Methods 203
7 Single-Dimensional Arrays 245 Chapters 34–42 are bonus Web chapters
8 Multidimensional Arrays 287 34 Advanced JavaFX 34-1
9 Objects and Classes 321 35 Advanced Database Programming 35-1
10 Object-Oriented Thinking 365 36 Internationalization 36-1
11 Inheritance and Polymorphism 409 37 Servlets 37-1
12 Exception Handling and Text I/O 449 38 JavaServer Pages 38-1
13 Abstract Classes and Interfaces 495 39 Web Services 39-1
14 JavaFX Basics 535 40 2-4 Trees and B-Trees 40-1
15 Event-Driven Programming 41 Red-Black Trees 41-1
and Animations 585 42 Testing Using JUnit 42-1
16 JavaFX UI Controls and Multimedia 629
17 Binary I/O 677
18 Recursion 705 Appendixes
19 Generics 737 A Java Keywords 1263
20 Lists, Stacks, Queues, B The ASCII Character Set 1266
and Priority Queues 761
C Operator Precedence Chart 1268
21 Sets and Maps 797
D Java Modifiers 1270
22 Developing Efficient Algorithms 821
E Special Floating-Point Values 1272
23 Sorting 861
F Number Systems 1273
24 Implementing Lists, Stacks, Queues,
and Priority Queues 895 G Bitwise Operatoirns 1277
25 Binary Search Trees 929 H Regular Expressions 1278
26 AVL Trees 965 I Enumerated Types 1283
27 Hashing 985
28 Graphs and Applications 1015 Index 1289

xi
CONTENTS
Chapter 1 Introduction to Computers, Programs,
and Java 1
1.1 Introduction 2
1.2 What Is a Computer? 2
1.3 Programming Languages 7
1.4 Operating Systems 9
1.5 Java, the World Wide Web, and Beyond 10
1.6 The Java Language Specification, API, JDK, and IDE 11
1.7 A Simple Java Program 12
1.8 Creating, Compiling, and Executing a Java Program 15
1.9 Programming Style and Documentation 18
1.10 Programming Errors 20
1.11 Developing Java Programs Using NetBeans 23
1.12 Developing Java Programs Using Eclipse 25

Chapter 2 Elementary Programming 33


2.1 Introduction 34
2.2 Writing a Simple Program 34
2.3 Reading Input from the Console 37
2.4 Identifiers 39
2.5 Variables 40
2.6 Assignment Statements and Assignment Expressions 41
2.7 Named Constants 43
2.8 Naming Conventions 44
2.9 Numeric Data Types and Operations 44
2.10 Numeric Literals 48
2.11 Evaluating Expressions and Operator Precedence 50
2.12 Case Study: Displaying the Current Time 52
2.13 Augmented Assignment Operators 54
2.14 Increment and Decrement Operators 55
2.15 Numeric Type Conversions 56
2.16 Software Development Process 59
2.17 Case Study: Counting Monetary Units 63
2.18 Common Errors and Pitfalls 65

Chapter 3 Selections 75
3.1 Introduction 76
3.2 boolean Data Type 76
3.3 if Statements 78
3.4 Two-Way if-else Statements 80
3.5 Nested if and Multi-Way if-else Statements 81
3.6 Common Errors and Pitfalls 83
3.7 Generating Random Numbers 87
3.8 Case Study: Computing Body Mass Index 89
3.9 Case Study: Computing Taxes 90
3.10 Logical Operators 93
3.11 Case Study: Determining Leap Year 97
3.12 Case Study: Lottery 98
3.13 switch Statements 100
3.14 Conditional Expressions 103
xii
xiii
3.15 Operator Precedence and Associativity 104
3.16 Debugging 106

Chapter 4 Mathematical Functions, Characters,


and Strings 119
4.1 Introduction 120
4.2 Common Mathematical Functions 120
4.3 Character Data Type and Operations 125
4.4 The String Type 130
4.5 Case Studies 139
4.6 Formatting Console Output 145

Chapter 5 Loops 157


5.1 Introduction 158
5.2 The while Loop 158
5.3 The do-while Loop 168
5.4 The for Loop 170
5.5 Which Loop to Use? 174
5.6 Nested Loops 176
5.7 Minimizing Numeric Errors 178
5.8 Case Studies 179
5.9 Keywords break and continue 184
5.10 Case Study: Checking Palindromes 187
5.11 Case Study: Displaying Prime Numbers 188

Chapter 6 Methods 203


6.1 Introduction 204
6.2 Defining a Method 204
6.3 Calling a Method 206
6.4 void Method Example 209
6.5 Passing Arguments by Values 212
6.6 Modularizing Code 215
6.7 Case Study: Converting Hexadecimals to Decimals 217
6.8 Overloading Methods 219
6.9 The Scope of Variables 222
6.10 Case Study: Generating Random Characters 223
6.11 Method Abstraction and Stepwise Refinement 225

Chapter 7 Single-Dimensional Arrays 245


7.1 Introduction 246
7.2 Array Basics 246
7.3 Case Study: Analyzing Numbers 253
7.4 Case Study: Deck of Cards 254
7.5 Copying Arrays 256
7.6 Passing Arrays to Methods 257
7.7 Returning an Array from a Method 260
7.8 Case Study: Counting the Occurrences of Each Letter 261
7.9 Variable-Length Argument Lists 264
7.10 Searching Arrays 265
7.11 Sorting Arrays 269
7.12 The Arrays Class 270
7.13 Command-Line Arguments 272

Chapter 8 Multidimensional Arrays 287


8.1 Introduction 288
8.2 Two-Dimensional Array Basics 288
xiv Contents
8.3 Processing Two-Dimensional Arrays 291
8.4 Passing Two-Dimensional Arrays to Methods 293
8.5 Case Study: Grading a Multiple-Choice Test 294
8.6 Case Study: Finding the Closest Pair 296
8.7 Case Study: Sudoku 298
8.8 Multidimensional Arrays 301

Chapter 9 Objects and Classes 321


9.1 Introduction 322
9.2 Defining Classes for Objects 322
9.3 Example: Defining Classes and Creating Objects 324
9.4 Constructing Objects Using Constructors 329
9.5 Accessing Objects via Reference Variables 330
9.6 Using Classes from the Java Library 334
9.7 Static Variables, Constants, and Methods 337
9.8 Visibility Modifiers 342
9.9 Data Field Encapsulation 344
9.10 Passing Objects to Methods 347
9.11 Array of Objects 351
9.12 Immutable Objects and Classes 353
9.13 The Scope of Variables 355
9.14 The this Reference 356

Chapter 10 Object-Oriented Thinking 365


10.1 Introduction 366
10.2 Class Abstraction and Encapsulation 366
10.3 Thinking in Objects 370
10.4 Class Relationships 373
10.5 Case Study: Designing the Course Class 376
10.6 Case Study: Designing a Class for Stacks 378
10.7 Processing Primitive Data Type Values as Objects 380
10.8 Automatic Conversion between Primitive Types
and Wrapper Class Types 383
10.9 The BigInteger and BigDecimal Classes 384
10.10 The String Class 386
10.11 The StringBuilder and StringBuffer Classes 392

Chapter 11 Inheritance and Polymorphism 409


11.1 Introduction 410
11.2 Superclasses and Subclasses 410
11.3 Using the super Keyword 416
11.4 Overriding Methods 419
11.5 Overriding vs. Overloading 420
11.6 The Object Class and Its toString() Method 422
11.7 Polymorphism 423
11.8 Dynamic Binding 424
11.9 Casting Objects and the instanceof Operator 427
11.10 The Object’s equals Method 431
11.11 The ArrayList Class 432
11.12 Useful Methods for Lists 438
11.13 Case Study: A Custom Stack Class 439
11.14 The protected Data and Methods 440
11.15 Preventing Extending and Overriding 442

Chapter 12 Exception Handling and Text I/O 449


12.1 Introduction 450
12.2 Exception-Handling Overview 450
Exploring the Variety of Random
Documents with Different Content
REMOVAL OF SILVER STAINS FROM THE HANDS,
LINEN, ETC.
The black stains upon the hands caused by Nitrate of Silver, may
readily be removed by moistening them and rubbing with a lump of
Cyanide of Potassium. As this salt however is highly poisonous, many
may prefer the following plan:—Wet the spot with a saturated
solution of Iodide of Potassium, and afterwards with Nitric Acid (the
strong Nitric Acid acts upon the skin and turns it yellow, it must
therefore be diluted with two parts of water before use); then wash
with solution of Hyposulphite of Soda.
Stains upon white linen may be easily removed by brushing them
with a solution of Iodine in Iodide of Potassium, and afterwards
washing with water and soaking in Hyposulphite of Soda, or Cyanide
of Potassium, until the yellow Iodide of Silver is dissolved out; the
Bichloride of Mercury (neutral solution) also answers well in many
cases, changing the dark spot to white (p. 151).
A TABLE SHOWING THE QUANTITY OF ANHYDROUS ACID IN
DILUTE SULPHURIC ACID OF DIFFERENT SPECIFIC GRAVITIES.
(URE.)

Real Acid Real Acid Real Acid


Specific in 100 Specific in 100 Specific in 100
Gravity. parts of the Gravity. parts of the Gravity. parts of the
Liquid. Liquid. Liquid.
1·8485 81·54 1·8115 73·39 1·7120 65·23
1·8475 80·72 1·8043 72·57 1·6993 64·42
1·8460 79·90 1·7962 71·75 1·6870 63·60
1·8439 79·09 1·7870 70·94 1·6750 62·78
1·8410 78·28 1·7774 70·12 1·6630 61·97
1·8376 77·46 1·7673 69·31 1·6520 61·15
1·8336 76·65 1·7570 68·49 1·6415 60·34
1·8290 75·83 1·7465 67·68 1·6321 59·52
1·8233 75·02 1·7360 66·86 1·6204 58·71
1·8179 74·20 1·7245 66·05 1·6090 57·89

A TABLE SHOWING THE QUANTITY OF ANHYDROUS ACID IN


THE LIQUID NITRIC ACID OF DIFFERENT SPECIFIC GRAVITIES.
(URE.)

Real Acid Real Acid Real Acid


Specific in 100 Specific in 100 Specific in 100
Gravity. parts of the Gravity. parts of the Gravity. parts of the
Liquid. Liquid. Liquid.
1·5000 79·700 1·4640 69·339 1·4147 58·978
1·4980 78·903 1·4600 68·542 1·4107 58·181
1·4960 78·106 1·4570 67·745 1·4065 57·384
1·4940 77·309 1·4530 66·948 1·4023 56·587
1·4910 76·512 1·4500 66·155 1·3978 55·790
1·4880 75·715 1·4460 65·354 1·3945 54·993
1·4850 74·918 1·4424 64·557 1·3882 54·196
1·4820 74·121 1·4385 63·760 1·3833 53·399
1·4790 73·324 1·4346 62·963 1·3783 52·602
1·4760 72·527 1·4306 62·166 1·3732 51·805
1·4730 71·730 1·4269 61·369 1·3681 51·068
1·4700 70·933 1·4228 60·572 1·3630 50·211
1·4670 70·136 1·4189 59·775 1·3579 49·414

WEIGHTS AND MEASURES.

Troy, or Apothecaries' Weight.


1 Pound = 12 Ounces. 1 Ounce = 8 Drachms. 1 Drachm
= 3 Scruples. 1 Scruple = 20 Grains. (1 Ounce Troy = 480
Grains, or 1 Ounce Avoirdupois plus 42·5 grains.)

Avoirdupois Weight.
1 Pound = 16 Ounces. 1 Ounce = 16 Drachms.
1 Drachm = 27·343 grains. (1 Ounce Avoirdupois = 437·5 grains.)
(1 Pound Avoirdupois = 7000 Grains, or 1 Pound Troy
plus 2½ Troy Ouncesplus 40 grains.)

Imperial Measure.
1 Gallon = 8 Pints. 1 Pint = 20 Ounces. 1 Ounce = 8 Drachms.
1 Drachm = 60 Minims. (A Wine Pint of water measures 16 Ounces,
and weighs a Pound.)
An Imperial Gallon of water weighs 10 Pounds Avoirdupois, or
70,000 Grains. An Imperial Pint of water weighs 1¼
Pound Avoirdupois. A fluid Ounce of water weighs 1 Ounce
Avoirdupois,
or 437·5 Grains. A Drachm of water weighs 54·7 Grains.

French Measures of Weight.


1 Kilogramme = 1000 Grammes = something less than
2¼ Pounds Avoirdupois.
1 Gramme = 10 Decigrammes—100 Centigrammes = 1000
Milligrammes = 15·433 English Grains.
A Gramme of water measures 17 English Minims, nearly
. 1000 Grammes of water measure 35¼ English fluid Ounces.

French Measures of Volume.


1 Litre = 13 Decilitres = 100 Centilitres = 1000 Millilitres
= 35¼ English fluid Ounces.
1 Litre = 1 Cubic Decimetre = 1000 Cubic Centimetres.
1 Cubic Centimetre = 17 English Minims.
A Litre of water weighs a Kilogramme, or something less than
2¼ Pounds Avoirdupois. A Cubic Centimetre of water weighs
a Gramme.
INDEX.[56]
[56] The preparation and properties of the Chemicals used in
Photography will be found in the Alphabetical List commencing at
page 327.

[A] [B] [C] [D] [E] [F] [G] [H] [I] [K]
[L] [M] [O] [P] [R] [S] [T] [V] [W]
Aberration, chromatic, 54;
spherical, 56.
Accelerating agents, their mode of action in Collodion explained, 95.
Acetate of Silver, its preparation and formula, 365;
its formation in Nitrate Bath explained, 89;
ensures absence of free Nitric Acid, 116;
tends slightly to favour fogging and spots, 104;
contra-indicated for glass Positives, 111.
Acetic Acid, properties and mode of testing purity of, 327;
useful in preventing fogging, 104;
in rendering the development slow and even, 99;
does not coagulate Albumen, 329;
a good commercial form of acid, 212;
Acetic Acid essential in Calotype, waxed paper, and Albumen
processes, 177;
also in printing paper Positives by development, 260.
Aceto-Nitrate of Silver, term explained, 177.
Achromatic Lenses, their construction explained, 55;
the visual and chemical foci often coincident in, 60.
Acids, nature of, 308.
Actinism, explained, 61;
importance of distinguishing Actinic from visual rays, 62;
mode of finding Actinic focus, 229.
Affinity, chemical, 312.
Albumen, its chemistry, 328;
forms a compound with oxide of Silver, 20;
used in Positive printing to produce a fine surface layer, 122;
to increase sensitiveness, 125;
affects the colour of the prints, 127;
protects the image from oxidation, 150;
putrifies when exposed to moisture, 155;
discolours the Nitrate Bath, 245.
Albumen negative process, its invention, 10;
theory of, 180;
Collodio-Albumen process of M. Taupenot, 294.
Albuminized paper, formula for, 241;
slow in fixing, 131;
not well adapted for toning by Sel d'or, 269;
good for stereoscopic subjects and small portraits, 249;
cannot be sensitized with Ammonio-Nitrate of Silver, 246.
Alcohol, its chemistry, 330;
sometimes too dilute for making Collodion, 84;
mode of rectifying, 196;
must not contain impurities, 96;
effects of adding to Collodion, 84, 96;
to developer, 205.
Alkalies, nature of, 308.
Alkalinity of Nitrate Bath, explained, 88;
the evils it produces, 104;
how to test for it, 377;
how to remove it, 277.
Amber varnish, 226.
Ammonia, preparation and properties, 331;
its use in fixing, 42;
Mr. Shadbolt's formula for, 271;
its action upon Chloride of Gold, 343;
effect of concentrated Ammonia upon Oxide of Silver, 362.
Ammonio-Nitrate of Silver, its chemistry, 262;
used in Positive printing to increase sensitiveness, 125;
to give black tones, 127;
cannot be used with Albumen, 246;
increases permanency of print, 169;
old Nitrate Baths not easily convertible into Ammonio-Nitrate, 248;
mode of preparing, 247;
best applied to the paper by brush or rod, 248;
Oxide of Silver in Nitrate of Ammonia, a useful substitute for it,
249.
Ammonio-Nitrate paper, formula for, 246;
a more simple formula, but less sensitive than the last, 258.
Atomic theory explained, 322.

Bath for fixing and toning Positives. See Fixing and toning Bath.
Bichloride of Mercury, whitening action on glass Positives explained,
113;
solution for, 207;
used to intensify Negatives, 118;
bleaches paper prints, 151;
should not be added to paste used in mounting prints, 164;
removes Silver stains, 377.
Binocular vision, phenomena of, explained, 66.
Blackening Negatives, 37, 117.
Black tones, mode of obtaining, in paper Positives, 168, 246.
Bromide of Silver, its preparation and properties, 17;
its superior sensibility to coloured light, 63;
less acted on by white light than Chloride, 19;
less sensitive to invisible image than Iodide, 25;
employment in Collodion, 101;
found useful in Photographing by artificial light, 66;
diagram of chemical spectrum on, 64.
Bromo-Iodide of Silver, 173.
Brushes, mode of applying Silver solutions by, 248.

Calotype process, theory of, 176.


Camera, its first invention, 7;
theory of its construction, 54;
mode of testing accuracy of, 229;
cause of the image being inverted, 53;
the term "flatness of field" explained, 54;
best position of the Camera for portraits, 220;
for architectural subjects, 231;
a funnel-shaped tube placed in front of the lens, 229;
stereoscopic Camera, 234;
microscope Camera, 236.
Causes of failure in Collodion process, 276.
Chemical affinity, illustrations of, 312.
Chemical elements, 306.
Chemical focus, directions for finding, 229;
shorter than visual in non achromatic lenses, 60;
longer than visual in microscopic objectives, 237;
varies slightly with the nature of the light, 238.
Chemical spectrum, 61.
Chemicals, Photographic, Vocabulary of, 327.
Chloride of Silver, its preparation and properties, 14;
more sensitive to white light than Bromide or Iodide, 19;
less sensitive to invisible image, 24;
its blackening by light explained, 20, 141;
accelerated by excess of Nitrate, 19;
by organic matter, 20, 142;
experiments illustrating darkening of papers prepared with, 21;
simple explanation of the mode of preparing sensitive papers with,
22;
agents which dissolve it, 42;
mode of reducing it to metallic state. 374.
Chloride of Gold, its preparation and properties, 342;
action of Ammonia upon it, 343;
use of an alkaline solution of, for toning, 132, 271;
compounds formed on adding it to Hyposulphite of Soda, 133;
mode of preparing the fixing and toning Bath with, 250;
the Sel d'or Bath with, 267.
Chromatic aberration, 54.
Citric Acid, forms a red compound with Suboxide of Silver, 21, 338;
used in printing to give purple tones, 128;
formula for preparing paper with, 246.
Cleaning glass plates, theory of, 39;
details of, 213.
Collodion, its discovery, 10;
chemistry of Pyroxyline, 75;
physical effect of Ether and Alcohol in, 83;
of water in, 85;
glutinosity of, 83;
coloration of iodized, explained, 85;
sensitiveness and intensity affected by the change, 97, 99;
details of manufacture of Collodion, 185;
Positive Collodion, theory of, 108;
formula for, 201;
Negative Collodion, theory of, 113;
formula for, 208;
Collodion for copying engravings, 231;
for keeping processes, 298;
for hot climates, 210;
for working by artificial light, 238;
to remove the brown colour from Collodion, 86.
Collodion film, the proper time for immersing it in the Bath, 219;
a thin film often good for direct Positives, 109;
a thicker film for Negatives, 113;
cause of the film falling away from the glass, 83, 293;
spots and markings on, 281;
conditions which affect its sensitiveness to light, 92;
causes influencing its behaviour with the developer, 98;
mode of preserving sensitiveness of film, 289.
Collodio-Albumen process, theory of, 181;
practical details of, 294.
Colours, their nature explained, 47;
their chemical action on sensitive film, 64;
their photographic action assisted by reflection of white light, 66.
Combination, laws of, 307.
Conjugate foci, explained, 52, 272.
Crookes, Mr., remarks upon chemical spectrum, 63;
upon waxed paper process, 180;
preservative process for Collodion films, 289.
Curvature of luminous image formed by lens, explained, 53.
Cyanide of Potassium, its fixing action explained, 44;
preparation of solution of, 207;
used to remove stains, 377.
Daguerreotype, its invention, 8;
theory of the process, 171.
Development of invisible image, explanation of, 34-40;
second, or intensifying stage explained, 37;
details of developing glass Positives and Negatives, 221-223;
development of paper Positives, 259;
conditions which increase or diminish rapidity of development, 98;
irregularities of development, 103.
Developers, their preparation and properties, 26;
comparative strength of, 98;
theory of, for Positives, 111;
for Negatives, 117;
formulæ for Positive developers, 205;
for Negative, 211.
Diagrams, mode of copying, 232.
Diaphragms for lenses. See Stops.
Double decomposition, illustrated, 14;
explained, 314.
Dry Collodion process, 298.

Elementary bodies, table of, 306;


combination of, 307.
Engravings, mode of copying, 231;
often yield dark-coloured prints, 255.
Equivalent proportions, 320.
Ether, properties of, 339;
purification of, for Photography, 195;
must be kept in a dark place, 196;
should not be distilled from residues of old Collodion, 96.
Experiments, illustrating action of Light upon Chloride of Silver, 21;
illustrating formation and development of invisible images, 25;
illustrating photographic action of coloured light, 62.
Exposure in the Camera, rules for Positives, 221;
for Negatives, 225;
for preserved Collodion plates, 292;
for microscopic photographs, 238;
effects of under and over-exposing, 35;
exposure required in Calotype process, 177;
in waxed paper, 180;
in Albumen negative process, 181;
in dry Collodion process, 301;
in Taupenot's process, 297.

Fading of Positives, explained at length, 160;


Author's researches on, 153.
Film, sensitive. See Collodion film.
Filters, mode of cutting, 376.
Fixing, theory of, 41;
of paper prints explained, 128;
solution for fixing glass Positives and Negatives, 212;
manipulatory details of fixing, 225;
fixing paper Positives with Ammonia, 271.
Fixing and toning Bath, its preparation, 250;
conditions which favour or retard its action, 135;
certain states of the Bath injurious to the proofs, 136;
importance of keeping it in an active condition, 168;
must not be employed immediately after mixing, 251;
must not be allowed to become acid by constant use, 168;
theory of the gradual change of properties it undergoes, 156.
Foci, actinic and luminous, 60;
actinic, mode of finding, 229;
variation between them in microscopic objectives, 237.
Focussing the object, 220.
Fogging, theory of, 103;
mode of detecting causes of, 276.
Formulæ for solutions required in Collodion process, 201;
for papers used in Positive printing, 241;
want of correspondence between, 257.

Gallic Acid, its preparation and properties, 27;


used in paper processes, 178;
becomes mouldy by keeping, 261.
formula for developing paper Positives with, 261.
Gallo-Nitrate of Silver, 177;
discolours rapidly when developing dishes are not clean, 179.
Gelatine, its properties, 341;
forms a compound with an Oxide of Silver, 21;
employed in dry Collodion process, 299;
modified form of, 302;
affects the colour in printing processes, 128;
used in Positive printing to form an even surface layer, 126;
as a cement to mount Photographs, 257.
Glass plates, rules for cleaning, 39;
details of cleaning, 213;
mode of coating with Collodion, 215;
with Albumen, 180.
Glutinous Collodion, explained, 83.
Glycyrrhizine, its nature, 342;
its action in Collodion, 114;
formula for solution of, 209.
Gold, Chloride of. See Chloride of Gold.
Gold salts, their use in Photographic printing explained, 131;
in the Daguerreotype process, 175.
Gradation of tone, in Collodion Photographs, affected by the density
of the film, 109, 113;
by use of Glycyrrhizine, 115.
Gradation of tone, in paper Positives, conditions affecting it in prints
obtained by direct exposure, 123;
in Positives printed by development, 266.

Hadow, Mr., researches on Collodion, 77;


formula for making Pyroxyline, 187.
Heliography, invented by M. Niépce, 7.
Historical sketch of Photography, 6.
Honey keeping process, 289.
Hunt, Mr., introduces Protosalts of Iron in developing, 111.
Hypo Bath. See Fixing and Toning Bath.
Hyposulphite of Silver, its peculiar changes in colour, 129;
the sweet compound which it forms with Hyposulphite of Soda,
44.
Hyposulphite of Soda, preparation and properties, 43;
theory of its fixing action, 43;
blackens Nitrate of Silver, 129;
causes a milkiness with acids, 137;
its decomposition by constant use in fixing, 138;
the salts it forms with Chloride of Gold, 133;
its conversion into sulphuretting Tetrathionate by Iodine and
Perchloride of Iron, 139;
test for presence of, 169.

Iceland moss, its use in Positive printing, 128;


formula for preparing paper with, 245.
Imperfections in Collodion Negatives, 282;
in Positives, 284;
in paper Positives, 285.
Intensity, explanation of term, 92;
mode of increasing in Negatives, 99, 114;
effect of Acetate of Silver upon, 116;
of Nitrite of Silver upon, 102;
mode of diminishing, in glass Positives, 109, 110;
conditions affecting intensity in paper Positives, 123;
in developed paper Positives, 266.
Invisible images, theory of formation of, 34;
development of, 36;
experiments illustrating, 25.
Iodate, how formed in Collodion film, 94;
produces insensitiveness, 198.
Iodide of Ammonium, preparation of, 198;
not fitted for iodizing Collodion required to be kept long, 210.
Iodide of Iron, an accelerator to Collodion, 116.
Iodide of Potassium and Silver, properties of, 42;
mode of iodizing Calotype papers by, 177.
Iodide of Potassium, tests of purity of, 197;
extent of solubility in Alcohol, 351;
dissolves Iodide of Silver, 42.
Iodide of Silver, its preparation and properties, 16;
unaffected by direct action of light, 19;
highly sensitive to invisible image, 24;
hypothesis of formation of latent image on, 34;
possibility of its reduction by Pyrogallic Acid shown, 33;
excess of Nitrate of Silver essential to its blackening by developer,
36;
diagrams of chemical spectrum on, 61, 64;
fixing agents for, 42;
its solubility in the Nitrate Bath, 86;
retards the action of Hypo fixing and toning Bath, 136;
superior permanency of developed prints on, 167;
details of Negative printing process on, 263.
Iodine, in Collodion, diminishes sensitiveness, 94;
forms Nitric Acid and Iodate in the Bath, 94;
often useful in Positive Collodion, 110;
in Negative Collodion, if fogging occurs, 105;
mode of removing from Collodion, 86.
Iodized Collodion. See Collodion.

Kaolin, properties of, 335;


used to decolorize Nitrate Baths, 91;
importance of purifying it before use, 245.

Landscape Photography, with preserved Collodion plates, 288.


Latent image. See Invisible image.
Laws of substitution explained, 78.
Le Grey, M,, his toning process with Chloride of Gold, 132;
his waxed paper Negative process, 178.
Lenses, various forms of, 51;
foci of, 52;
formation of images by, 53;
use of stops, 58;
portrait, 59;
chemical foci of, 60;
chromatic aberration of, 54;
spherical aberration of, 56;
simple directions for using lenses, 227;
for finding chemical focus, 229.
Light; its action upon Silver Salts, 19;
experiments illustrating, 21;
formation of invisible images by, 24;
its alternating action upon Daguerreotype plate, 39;
its compound nature, 46;
photographic action of coloured light, 60;
refraction of light, 49.
Llewellyn, Mr., his Oxymel process, 291.

Manipulations of Collodion process, 213;


of Photographic printing, 251;
of toning by Sel d'or, 267.
Manuscripts, mode of copying, 231.
Markings on Collodion Pictures, 281.
Measures and Weights, 379.
Microscopic Photography, 235.
Moser, M. Ludwig, his researches on the development of invisible
images, 37.
Mounting Positive Prints, substances which should be avoided in,
155, 164;
details of, 257.

Negative processes for printing Positives, 259, 263.


Negatives, definition of, 106;
Collodion Negatives, theory of production of, 113;
Calotype, 176;
waxed paper, 178;
Albumen, 180;
Collodio-Albumen (Taupenot), 181;
mode of developing Collodion Negatives, 37, 117, 223;
of converting Positives into, 117;
formula for solutions for Negatives, 208;
the Collodion best adapted for Negatives, 114;
spots and markings upon Negatives, 282;
decomposition of Pyroxyline a cause of fading of, 166.
Nitrate of Silver, preparation and properties of, 12;
preparation of from standard coin of realm, 362;
often contains free Nitric Acid, 13;
when very strongly fused, contains Nitrite (see Nitrite of Silver),
14;
not acted on by light, 18;
its reduction by Pyrogallic Acid explained, 31;
the melted Nitrate more certain in its action, 13, 101;
its presence essential in developing the image, 36, 98;
increases sensitiveness of Collodion plate, 92;
dissolves Iodide of Silver, 86;
discoloured by Albumen, 245, 329;
forms a compound with Honey, 289;
with various other organic bodies, 21;
very little acted on by Glycerine, 342;
mode of recovering the Silver from, 372.
Nitrate Bath, mode of preparing for glass Positives, 110, 203;
for Collodion Negatives, 116, 211;
its power of dissolving Iodide of Silver, its occasional acidity and
alkalinity explained, 86;
the mode in which Acetate of Silver may be formed in it, 89;
a list of the substances by which it is decomposed, 90;
changes by use, 91;
effect of these changes on sensitiveness, 97;
on intensity, 102;
care required to prevent it from yielding foggy pictures, 104;
a caution against the too frequent addition of alkali, 204;
quantitative testing of the Bath, 371.
Nitrite of Silver, adds to rapidity of development, 102;
tends slightly to produce fogging, 104;
solarizes the high lights, 111.
Nitric Acid, its preparation and properties, 355;
its oxidizing powers, 12;
impairs sensitiveness of Collodion film, 93;
lessens rapidity of development, 98;
tends to prevent fogging, 104;
sometimes usefully employed for glass Positives, 110;
contra-indicated for Negatives, 116;
its accumulation in the Nitrate Bath explained, 94;
mode of removing it, 90;
cannot exist in contact with Acetate of Silver, 116;
produces stains on cloth, 215;
mode of determining the strength of Commercial Nitric Acid, 186;
table of strength of Nitric Acid of different densities, 378.
Nitro-Sulphuric Acid, explained, 77;
process for making by mixed acids, 186;
by Oil of Vitriol and Nitre, 190;
should not be used cold, 83.
Nomenclature, chemical, 315.
Norris, Dr., his dry Collodion process, 298.
Notation, chemical, 318.

Organic bodies, chemistry of, 324.


Oxide of Silver, preparation and properties, 17;
dissolves in the Nitrate Bath, rendering it alkaline, 88;
properties of its solution in Ammonia, 362;
preparation of ditto, 247;
its solution in Nitrate of Ammonia used in Photography, 249.
Oxymel, keeping process, 291;
preparation of Oxymel, 360.
Paper, Photographic, selection of, 240;
peculiarity of English papers, 241.
Paper, sensitive, for printing. See Sensitive Paper.
Perchloride of Iron, preparation of toning Bath with, 160.
Permanence of Positives, mode of testing, 169.
Photographic image, chemical composition of, 140;
action of destructive tests on, 145.
Photographic properties of Salts of Silver, 18;
of Iodide of Silver upon Collodion, 74.
Photographic researches by the Author, 140.
Photography, historical sketch of, 6;
the term explained, 61.
Portrait lenses, theory of their construction, 59;
rules for their use, 227;
mode of finding chemical focus, 229.
Portraits, drapery for, 66;
directions for taking, 220;
the position of the Camera, and other points of importance, 228;
the time of exposure, 221.
Positive printing, on Albuminized paper, formulæ for, 241;
on plain paper, formulæ for, 245;
on Ammonio-Nitrate paper, formula for, 246, 258;
by development, formulæ for, 259;
manipulatory details of printing, fixing, toning, washing, and
mounting, 251;
process of toning by Sel d'or, theory of, 134;
practice of, 267;
reasons for the want of correspondence between different
formulæ, 257;
use of Chloride of Gold in toning, 132, 271;
theory of the preparation of the sensitive paper for Positives, 122;
theory of the process of fixing, 129;
of toning by Gold, 132;
the Author's researches, 140;
rationale of the printing process, 120;
composition of the image, 140;
fading of Positive prints, 160;
destructive action of Sulphur on, 145;
of oxidizing agents on, 148;
of Chlorine, acids, boiling water, etc., on, 151;
of combustion of coal-gas on, 153;
effect of damp air on, 153;
theory of mode of washing Positives, 162;
comparative permanency of prints, 166;
mode of testing permanency, 169.
Positives, definition of, 106;
Collodion Positives, theory of production of, 108;
formulæ for solutions for, 201;
development of, 111, 221;
Collodion and Nitrate Bath best adapted for, 109;
mode of whitening by Bichloride of Mercury, 112;
solution for whitening, 207;
mode of backing up, 226;
spots and markings on, 284;
mode of printing Positives on Collodion, 272.
Positives, enlarged, mode of printing, 272.
Practice of Collodion process, 183.
Preservative processes for Collodion plates, 289.
Printing, Photographic, theory of, 120;
practical details of, 240.
Prism, refraction of light by, 51;
diagram of formation of spectrum by, 47;
explained, 54.
Prismatic spectrum, 47, 61.
Protonitrate of Iron, preparation of, 206;
a feeble developer when free from excess of Sulphate of Iron, 98;
theory of its mode of action, and rules for its use, 112;
cannot be prepared in quantity by adding Nitrate of Potash to
Sulphate of Iron, 314;
sometimes requires the addition of Nitrate of Silver, 206.
Protosulphate of Iron, its preparation and properties, 29;
its characteristics as a developer for Collodion Positives, 111;
not well adapted for developing Collodion Negatives, 117;
preparation of the solution for Positives, 205;
mode of applying it to the plate, 221;
to remove iron stains on glass, 215.
Pyrogallic Acid, its preparation and properties, 28;
solution for developing glass Positives, 205;
for Negatives, 211;
cannot be used without Acetic Acid, 105;
less adapted for developing paper pictures, 178;
requires addition of Nitric Acid when used for Positives, 111;
superior to Sulphate of Iron for developing Negatives, 117, 144;
mode of obviating the brown discoloration of developing solutions,
212.
Pyroxyline, its nature and properties, 75;
preparation of, by Mr. Hadow's formula, 186;
by a rule-of-thumb mixture of the acids, 188;
by the Oil of Vitriol and Nitre process, 190;
details of immersing, washing, and drying, 191;
the glutinous variety produced by cold acids, 83;
recapitulation of the effects of varying the strength of the acid
mixture, 193;
spontaneous decomposition of Pyroxyline, 166.

Reduction of metallic oxides by developers, theory of, 26;


of Silver salts by developers, theory of, 30;
practical details of reducing Silver compounds to metallic state,
372.

Salts nature of, 310.


Salts of Silver, their preparation and properties, 12;
their Photographic action, 18;
theory of their reduction by developer, 30;
directions for obtaining metal from, 372.
Sel d'or, toning process by, its theory, 134;
its practical details, 267;
its advantages, 271;
gives permanent prints, 167.
Sensitiveness, term explained, 92;
conditions favourable to, 97.
Sensitiveness of Collodion film, causes influencing, 92;
superior sensitiveness partially explained, 74;
preservation of sensitive film, 288.
Sensitive paper, theory of preparation of, 22, 122;
its darkening by light described, 123;
preparation of Albuminized paper, 241;
of plain paper, 245;
of Ammonio-Nitrate paper, 246, 258;
of paper for Negative processes, 259;
causes which affect the sensitiveness of Positive paper, 123;
which alter the colour of the image, 126;
spots and markings on, 285;
a large excess of Nitrate of Silver essential, 124;
the paper should not be kept too long, 130, 286.
Serum of Milk, preparation of, 262, 355;
used in Negative printing process, 262.
Shadbolt, Mr., his Honey keeping process, 289;
employs artificial light in Micro-Photography, 237.
Silver, properties of, 362;
estimation of, in Nitrate Baths, 371;
recovery from waste solutions, 372;
reduction from Chloride, 374;
stains, removal of, 377.
Size, mode of removing, from paper Positives, 255.
Solar spectrum, 47, 61.
Soluble paper. See Pyroxyline.
Specific gravity of liquids, mode of finding, 375.
Spherical aberration, 56.
Spirits of Wine, preparation and properties, 330;
not always sufficiently strong for Collodion, 84;
mode of rectifying, 196;
sometimes contaminated with, fusel oil, 96.
Spots on Collodion plates, 279;
on paper Positives, 285;
on prints obtained by development, 266;
on preserved Collodion plates, 293.
Stains, Silver, removal of, 377.
Stereoscope, invention of, 67;
theory of, 68;
Wheatstone's, 69;
Brewster's, 70.
Stereoscopic Photographs, rules for taking, 71;
practical details of, 232.
Stops, theory of use of, 57;
simple mode of making, 228;
position of the stop often important, 230.
Strength of acids, tables of, 378.
Subchloride of Silver, its preparation and properties, 15;
decomposed by fixing agents, 141.
Suboxide of Silver, its properties, 18;
forms compounds with organic matters. Citric Acid, Albumen, etc.,
21.
Substitution, laws of, explained, 78.
Sulphate of Iron. See Protosulphate of Iron.
Sulphate of Quinine, absorption of chemical rays by, 65.
Sulphuric Acid, table of strength of, 378.
Sutton, Mr., theory of Sel d'or toning process, 134;
practical details of, 267;
Negative printing process, 262;
preparation of Serum of Milk for, 355.
Symbols, use of, 318.
Syruped Collodion film, 289.

Talbot, Mr., his discoveries, 9;


theory of Calotype process, 176.
Taupenot, M., his Collodio-Albumen process, 181;
practical details of, 294.
Temperature, its effect upon development of Collodion film, 102;
upon fogging, 105;
upon keeping Collodion, 210;
upon action of fixing Bath for paper Positives, 130;
upon Hypo toning Bath, 136.
Test-papers, use of, 376.
Toning Bath for Positives, with Sel d'or, 134, 267;
with Hyposulphite and Gold, see Fixing and Toning Bath;
with Chloride of Iron and Hyposulphite, 160.
Toning of Positives, term defined, 121;
may injure the stability of the proof, 154;
points to be kept in view to avoid fading, 167;
manipulatory details of, 253;
by Sel d'or, 267.
Transparencies, mode of printing, 273.

Varnishes for Collodion Photographs, 226.


View Lenses, directions for using, 230.
Vocabulary of Photographic chemicals, 327.

Washing Positive prints, rules for, 162;


details of, 255.
Waxed paper process, theory of, 178.
Weights and Measures, table of, 379.
PRINTED BY JOHN EDWARD TAYLOR, LITTLE QUEEN
STREET, LINCOLN'S INN FIELDS.

Transcriber Note
Minor typos have been corrected. Images moved to
prevent splitting paragraphs. All images are derived from
materials provided by The Internet Archive and are placed in
the Public Domain.
*** END OF THE PROJECT GUTENBERG EBOOK A MANUAL OF
PHOTOGRAPHIC CHEMISTRY, INCLUDING THE PRACTICE OF THE
COLLODION PROCESS ***

Updated editions will replace the previous one—the old editions will
be renamed.

Creating the works from print editions not protected by U.S.


copyright law means that no one owns a United States copyright in
these works, so the Foundation (and you!) can copy and distribute it
in the United States without permission and without paying
copyright royalties. Special rules, set forth in the General Terms of
Use part of this license, apply to copying and distributing Project
Gutenberg™ electronic works to protect the PROJECT GUTENBERG™
concept and trademark. Project Gutenberg is a registered trademark,
and may not be used if you charge for an eBook, except by following
the terms of the trademark license, including paying royalties for use
of the Project Gutenberg trademark. If you do not charge anything
for copies of this eBook, complying with the trademark license is
very easy. You may use this eBook for nearly any purpose such as
creation of derivative works, reports, performances and research.
Project Gutenberg eBooks may be modified and printed and given
away—you may do practically ANYTHING in the United States with
eBooks not protected by U.S. copyright law. Redistribution is subject
to the trademark license, especially commercial redistribution.

START: FULL LICENSE


THE FULL PROJECT GUTENBERG LICENSE
PLEASE READ THIS BEFORE YOU DISTRIBUTE OR USE THIS WORK

To protect the Project Gutenberg™ mission of promoting the free


distribution of electronic works, by using or distributing this work (or
any other work associated in any way with the phrase “Project
Gutenberg”), you agree to comply with all the terms of the Full
Project Gutenberg™ License available with this file or online at
www.gutenberg.org/license.

Section 1. General Terms of Use and


Redistributing Project Gutenberg™
electronic works
1.A. By reading or using any part of this Project Gutenberg™
electronic work, you indicate that you have read, understand, agree
to and accept all the terms of this license and intellectual property
(trademark/copyright) agreement. If you do not agree to abide by all
the terms of this agreement, you must cease using and return or
destroy all copies of Project Gutenberg™ electronic works in your
possession. If you paid a fee for obtaining a copy of or access to a
Project Gutenberg™ electronic work and you do not agree to be
bound by the terms of this agreement, you may obtain a refund
from the person or entity to whom you paid the fee as set forth in
paragraph 1.E.8.

1.B. “Project Gutenberg” is a registered trademark. It may only be


used on or associated in any way with an electronic work by people
who agree to be bound by the terms of this agreement. There are a
few things that you can do with most Project Gutenberg™ electronic
works even without complying with the full terms of this agreement.
See paragraph 1.C below. There are a lot of things you can do with
Project Gutenberg™ electronic works if you follow the terms of this
agreement and help preserve free future access to Project
Gutenberg™ electronic works. See paragraph 1.E below.
1.C. The Project Gutenberg Literary Archive Foundation (“the
Foundation” or PGLAF), owns a compilation copyright in the
collection of Project Gutenberg™ electronic works. Nearly all the
individual works in the collection are in the public domain in the
United States. If an individual work is unprotected by copyright law
in the United States and you are located in the United States, we do
not claim a right to prevent you from copying, distributing,
performing, displaying or creating derivative works based on the
work as long as all references to Project Gutenberg are removed. Of
course, we hope that you will support the Project Gutenberg™
mission of promoting free access to electronic works by freely
sharing Project Gutenberg™ works in compliance with the terms of
this agreement for keeping the Project Gutenberg™ name associated
with the work. You can easily comply with the terms of this
agreement by keeping this work in the same format with its attached
full Project Gutenberg™ License when you share it without charge
with others.

1.D. The copyright laws of the place where you are located also
govern what you can do with this work. Copyright laws in most
countries are in a constant state of change. If you are outside the
United States, check the laws of your country in addition to the
terms of this agreement before downloading, copying, displaying,
performing, distributing or creating derivative works based on this
work or any other Project Gutenberg™ work. The Foundation makes
no representations concerning the copyright status of any work in
any country other than the United States.

1.E. Unless you have removed all references to Project Gutenberg:

1.E.1. The following sentence, with active links to, or other


immediate access to, the full Project Gutenberg™ License must
appear prominently whenever any copy of a Project Gutenberg™
work (any work on which the phrase “Project Gutenberg” appears,
or with which the phrase “Project Gutenberg” is associated) is
accessed, displayed, performed, viewed, copied or distributed:
This eBook is for the use of anyone anywhere in the United
States and most other parts of the world at no cost and with
almost no restrictions whatsoever. You may copy it, give it away
or re-use it under the terms of the Project Gutenberg License
included with this eBook or online at www.gutenberg.org. If you
are not located in the United States, you will have to check the
laws of the country where you are located before using this
eBook.

1.E.2. If an individual Project Gutenberg™ electronic work is derived


from texts not protected by U.S. copyright law (does not contain a
notice indicating that it is posted with permission of the copyright
holder), the work can be copied and distributed to anyone in the
United States without paying any fees or charges. If you are
redistributing or providing access to a work with the phrase “Project
Gutenberg” associated with or appearing on the work, you must
comply either with the requirements of paragraphs 1.E.1 through
1.E.7 or obtain permission for the use of the work and the Project
Gutenberg™ trademark as set forth in paragraphs 1.E.8 or 1.E.9.

1.E.3. If an individual Project Gutenberg™ electronic work is posted


with the permission of the copyright holder, your use and distribution
must comply with both paragraphs 1.E.1 through 1.E.7 and any
additional terms imposed by the copyright holder. Additional terms
will be linked to the Project Gutenberg™ License for all works posted
with the permission of the copyright holder found at the beginning
of this work.

1.E.4. Do not unlink or detach or remove the full Project


Gutenberg™ License terms from this work, or any files containing a
part of this work or any other work associated with Project
Gutenberg™.

1.E.5. Do not copy, display, perform, distribute or redistribute this


electronic work, or any part of this electronic work, without
prominently displaying the sentence set forth in paragraph 1.E.1
with active links or immediate access to the full terms of the Project
Gutenberg™ License.

1.E.6. You may convert to and distribute this work in any binary,
compressed, marked up, nonproprietary or proprietary form,
including any word processing or hypertext form. However, if you
provide access to or distribute copies of a Project Gutenberg™ work
in a format other than “Plain Vanilla ASCII” or other format used in
the official version posted on the official Project Gutenberg™ website
(www.gutenberg.org), you must, at no additional cost, fee or
expense to the user, provide a copy, a means of exporting a copy, or
a means of obtaining a copy upon request, of the work in its original
“Plain Vanilla ASCII” or other form. Any alternate format must
include the full Project Gutenberg™ License as specified in
paragraph 1.E.1.

1.E.7. Do not charge a fee for access to, viewing, displaying,


performing, copying or distributing any Project Gutenberg™ works
unless you comply with paragraph 1.E.8 or 1.E.9.

1.E.8. You may charge a reasonable fee for copies of or providing


access to or distributing Project Gutenberg™ electronic works
provided that:

• You pay a royalty fee of 20% of the gross profits you derive
from the use of Project Gutenberg™ works calculated using the
method you already use to calculate your applicable taxes. The
fee is owed to the owner of the Project Gutenberg™ trademark,
but he has agreed to donate royalties under this paragraph to
the Project Gutenberg Literary Archive Foundation. Royalty
payments must be paid within 60 days following each date on
which you prepare (or are legally required to prepare) your
periodic tax returns. Royalty payments should be clearly marked
as such and sent to the Project Gutenberg Literary Archive
Foundation at the address specified in Section 4, “Information

You might also like