ebook img

Java Methods A&AB, AP Edition PDF

668 Pages·2006·7.38 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Java Methods A&AB, AP Edition

Java Java Methods Methods AA && AABB Object-Oriented Programming and Data Structures Maria Litvin Phillips Academy, Andover, Massachusetts Gary Litvin Skylight Software, Inc. Skylight Publishing Andover, Massachusetts Skylight Publishing 9 Bartlet Street, Suite 70 Andover, MA 01810 web: http://www.skylit.com e-mail: [email protected] [email protected] Copyright © 2006 by Maria Litvin, Gary Litvin, and Skylight Publishing All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by any means, electronic, mechanical, photocopying, recording, or otherwise, without the prior written permission of the authors and Skylight Publishing. Library of Congress Control Number: 2005910949 ISBN 978-0-9727055-7-8 The names of commercially available software and products mentioned in this book are used for identification purposes only and may be trademarks or registered trademarks owned by corporations and other commercial entities. Skylight Publishing and the authors have no affiliation with and disclaim any sponsorship or endorsement by any of these products’ manufacturers or trademarks’ owners. Sun, Sun Microsystems, Java, and Java logos are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and other countries. SCRABBLE® is the registered trademark of HASBRO in the United States and Canada and of J.W. Spear and Sons, PLC, a subsidiary of Mattel, Inc., outside the United States and Canada. 1 2 3 4 5 6 7 8 9 10 11 10 09 08 07 06 Printed in the United States of America To Marg and Aaron Brief Contents Preface How to Use This Book Chapter 1 An Introduction to Hardware, Software, and the Internet Chapter 2 An Introduction to Software Development Chapter 3 Objects and Classes Chapter 4 Algorithms Chapter 5 Java Syntax and Style Chapter 6 Data Types, Variables, and Arithmetic Chapter 7 Boolean Expressions and if-else Statements Chapter 8 Iterative Statements: while, for, do–while Chapter 9 Implementing Classes and Using Objects Chapter 10 Strings Chapter 11 Class Hierarchies and Interfaces Chapter 12 Arrays and ArrayLists Chapter 13 Searching and Sorting Chapter 14 Streams and Files Chapter 15 Graphics Chapter 16 GUI Components and Events Chapter 17 Mouse, Keyboard, Sounds, and Images Chapter 18 Big-O Analysis of Algorithms Chapter 19 The Java Collections Framework Chapter 20 Linked Lists Chapter 21 Stacks and Queues (cid:174) Continued Draft. Copyright © 2006 by Skylight Publishing. Chapter 22 Recursion Revisited Chapter 23 Binary Trees Chapter 24 Lookup Tables and Hashing Chapter 25 Priority Queues Chapter 26 Design Patterns Appendix A The 17 Bits of Style $ Appendix B Common Syntax Error Messages $ Appendix C HTML Tutorial $ Appendix D GUI Examples Index $ Appendix E The EasyReader, EasyWriter, EasySound, EasyDate, and EasyFormat Classes $ Appendix F Computing in Context: Responsible, Ethical, and Effective Computer Use $ Index Draft. Copyright © 2006 by Skylight Publishing. Contents Preface xvii How to Use This Book xxi Chapter 1. An Introduction to Hardware, Software, and the Internet 1 1.1 Prologue 1.2 Hardware Overview $ 1.2.1 The CPU 1.2.2 Memory 1.2.3 Secondary Storage Devices 1.2.4 Input and Output Devices 1.3 Software Overview 1.4 Representation of Information in Computer Memory 1.4.1 Numbers 1.4.2 Characters 1.5 The Internet 1.6 Summary Exercises Chapter 2. An Introduction to Software Development 2.1 Prologue 2.2 Compilers and Interpreters 2.3 Software Components and Packages 2.4 Lab: Three Ways to Say Hello 2.5 Object-Oriented Programming 2.6 Lab: More Ways to Say Hello 2.7 Summary Exercises Draft. Copyright © 2006 by Skylight Publishing. viii CONTENTS Chapter 3. Objects and Classes 3.1 Prologue 3.2 Case Study: First Steps 3.3 Classes 3.4 Fields, Constructors, and Methods 3.5 Case Study: First Steps Continued 3.6 Inheritance 3.7 Summary Exercises Chapter 4. Algorithms 4.1 Prologue 4.2 Properties of Algorithms 4.3 Iterations 4.4 Recursion 4.5 Case Study: Euclid’s GCF Algorithm 4.6 Working with Lists 4.7 Case Study: File Manager 4.8 Summary Exercises Chapter 5. Java Syntax and Style 5.1 Prologue 5.2 Using Comments 5.3 Reserved Words and Programmer-Defined Names 5.4 Syntax vs. Style 5.5 Statements, Blocks, Indentation 5.6 Lab: Correcting Syntax Errors 5.7 Summary Exercises Draft. Copyright © 2006 by Skylight Publishing. ix CONTENTS Chapter 6. Data Types, Variables, and Arithmetic 6.1 Prologue 6.2 Declaring Fields and Local Variables 6.3 Primitive Data Types 6.4 Strings 6.5 Constants 6.6 Scope of Variables 6.7 Arithmetic Expressions 6.8 Compound Assignment and Increment Operators 6.9 Converting Numbers and Objects into Strings 6.10 Lab: Pie Chart 6.11 Summary Exercises Chapter 7. Boolean Expressions and if-else Statements 7.1 Prologue 7.2 if–else Statements 7.3 boolean Data Type 7.4 Relational Operators 7.5 Logical Operators 7.6 Order of Operators 7.7 Short-Circuit Evaluation 7.8 if–else–if and Nested if–else 7.9 Case Study and Lab: Rolling Dice 7.10 The switch statement 7.11 Enumerated Data Types 7.12 Case Study and Lab: Rolling Dice Continued 7.13 Summary Exercises Chapter 8. Iterative Statements: while, for, do-while 8.1 Prologue 8.2 The while and for Loops 8.3 The do–while Loop 8.4 return and break in Loops 8.5 Nested Loops 8.6 Lab: Perfect Numbers 8.7 Summary Exercises Draft. Copyright © 2006 by Skylight Publishing. x CONTENTS Chapter 9. Implementing Classes and Using Objects 9.1 Prologue 9.2 Public and Private Features of a Class 9.3 Constructors 9.4 References to Objects 9.5 Defining Methods 9.6 Calling Methods and Accessing Fields 9.7 Passing Parameters to Constructors and Methods 9.8 return Statement 9.9 Case Study and Lab: Snack Bar 9.10 Overloaded Methods 9.11 Static Fields and Methods 9.12 Case Study and Lab: Snack Bar Continued 9.13 Summary Exercises Chapter 10. Strings 10.1 Prologue 10.2 Literal Strings 10.3 String Constructors and Immutability 10.4 String Methods 10.5 Converting Numbers into Strings and Strings into Numbers 10.6 Character Methods 10.7 Lab: Lipogrammer 10.8 The StringBuffer Class 10.9 Summary Exercises Chapter 11. Class Hierarchies and Interfaces 11.1 Prologue 11.2 Class Hierarchies and Polymorphism 11.3 Abstract Classes 11.4 Invoking Superclass’s Constructors 11.5 Calling Superclass’s Methods 11.6 Case Study: Dance Studio 11.7 Interfaces 11.8 Case Study: Dance Studio Continued 11.9 Summary Exercises Draft. Copyright © 2006 by Skylight Publishing.

Description:
Once again, the Litvins bring you a textbook that expertly covers the subject, is fun to read, and works for students with different learning styles. In one volume, this edition covers both introductory Java/OOP A-level material and AB-level topics (data structures and algorithms). The book follows
See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.