Java How to Program, 4/e

Harvey M. Deitel, Paul J. Deitel

  • 出版商: Prentice Hall
  • 出版日期: 2001-08-08
  • 售價: $1,100
  • 貴賓價: 9.5$1,045
  • 語言: 英文
  • 頁數: 1546
  • 裝訂: Paperback
  • ISBN: 0130341517
  • ISBN-13: 9780130341518
  • 相關分類: Java 程式語言
  • 無法訂購




The authoritative DEITEL LIVE-CODE introduction to programming with the Java 2 Platform, Standard Edition (J2SE)

Java has revolutionized software development with multimedia-intensive, platform-independent, object-oriented code for conventional, Internet-, Intranet- and Extranet-based applications and applets. This exciting new Fourth Edition of the world's best-selling Java textbook now has a companion volume—Advanced Java 2 Platform How to Program—which focuses on the Java 2 Platform, Enterprise Edition (J2EE), presents advanced J2SE features and introduces the Java 2 Platform, Micro Edition (J2ME).

Dr. Harvey M. Deitel and Paul J. Deitel are the founders of Deitel & Associates, Inc., the internationally recognized corporate training and content-creation organization specializing in Java, C++, C, Visual C#, Visual Basic®, Visual C++®, .NET, XML, Python, Perl, Internet, Web and object technologies. The Deitels are also the authors of the world's #1 C++ textbook—C++ How to Program, 3/e—and many other best sellers.

In Java How to Program, Fourth Edition the Deitels introduce the fundamentals of object-oriented programming in Java. The 4th edition includes an optional 180-page case study that introduces object-oriented design with the UML. Key 4th edition topics include:

  • Applications/Applets
  • Swing GUI/Event Handling
  • Classes/Objects/Interfaces
  • Encapsulation/Inner Classes
  • OOP/Inheritance/Polymorphism
  • Data Structures/Collections
  • Files/Streams/Serialization
  • Networking/Client/Server/Internet/Web
  • Graphics/Java2D/Images/Animation
  • JMF/Java Sound/Audio/Video/MIDI
  • (Optional) OOD/UML/Design Patterns
  • Exceptions/Multithreading

Java How to Program, Fourth Edition includes extensive pedagogic features:

  • Hundreds of LIVE-CODE programs with screen captures that show exact outputs
  • Extensive World Wide Web and Internet resources to encourage further research
  • Hundreds of tips, recommended practices and cautions—all marked with icons
    — Good Programming Practices
    —Software Engineering Observations
    —Performance Tips
    —Look-and-Feel Observations
    —Testing and Debugging Tips
    —Common Programming Errors

Table of Contents

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

Introduction. What Is a Computer? Computer Organization. Evolution of Operating Systems. Personal, Distributed and Client/Server Computing. Machine Languages, Assembly Languages and High-Level Languages. History of C++. History of Java. Java Class Libraries. Other High-Level Languages. Structured Programming. The Internet and the World Wide Web. Basics of a Typical Java Environment. General Notes about Java and This Book. Thinking About Objects: Introduction to Object Technology and the Unified Modeling Language. Discovering Design Patterns: Introduction. Tour of the Book. (Optional) A Tour of the Case Study on Object-Oriented Design with the UML. (Optional) A Tour of the "Discovering Design Patterns" Sections.

2. Introduction to Java Applications.

Introduction. A First Program in Java: Printing a Line of Text. Modifying Our First Java Program. Displaying Text in a Dialog Box. Another Java Application: Adding Integers. Memory Concepts. Arithmetic. Decision Making: Equality and Relational Operators. (Optional Case Study) Thinking About Objects: Examining the Problem Statement.

3. Introduction to Java Applets.

Introduction. Sample Applets from the Java 2 Software Development Kit. A Simple Java Applet: Drawing a String. Two More Simple Applets: Drawing Strings and Lines. Another Java Applet: Adding Floating-Point Numbers. Viewing Applets in a Web Browser. Java Applet Internet and World Wide Web Resources. (Optional Case Study) Thinking About Objects: Identifying the Classes in a Problem Statement.

4. Control Structures: Part 1.

Introduction. Algorithms. Pseudocode. Control Structures. The if Selection Structure. The if/else Selection Structure. The while Repetition Structure. Formulating Algorithms: Case Study 1 (Counter-Controlled Repetition). Formulating Algorithms with Top-Down, Stepwise Refinement: Case Study 2 (Sentinel-Controlled Repetition). Formulating Algorithms with Top-Down, Stepwise Refinement: Case Study 3 (Nested Control Structures). Assignment Operators. Increment and Decrement Operators. Primitive Data Types. (Optional Case Study) Thinking About Objects: Identifying Class Attributes.

5. Control Structures: Part 2.

Introduction. Essentials of Counter-Controlled Repetition. The for Repetition Structure. Examples Using the for Structure. The switch Multiple-Selection Structure. The do/while Repetition Structure. Statements break and continue. Labeled break and continue Statements. Logical Operators. Structured Programming Summary. (Optional Case Study) Thinking About Objects: Identifying Objects' States and Activities.

6. Methods.

Introduction. Program Modules in Java. Math Class Methods. Methods. Method Definitions. Argument Promotion. Java API Packages. Random-Number Generation. Example: A Game of Chance. Duration of Identifiers. Scope Rules. Recursion. Example Using Recursion: The Fibonacci Series. Recursion vs. Iteration. Method Overloading. Methods of Class Japplet. (Optional Case Study) Thinking About Objects: Identifying Class Operations.

7. Arrays.

Introduction. Arrays. Declaring and Allocating Arrays. Examples Using Arrays. References and Reference Parameters. Passing Arrays to Methods. Sorting Arrays. Searching Arrays: Linear Search and Binary Search. Multiple-Subscripted Arrays. (Optional Case Study) Thinking About Objects: Collaboration Among Objects.

8. Object-Based Programming.

Introduction. Implementing a Time Abstract Data Type with a Class. Class Scope. Controlling Access to Members. Creating Packages. Initializing Class Objects: Constructors. Using Overloaded Constructors. Using Set and Get Methods. Software Reusability. Final Instance Variables. Composition: Objects as Instance Variables of Other Classes. Package Access. Using the this Reference. Finalizers. Static Class Members. Data Abstraction and Encapsulation. (Optional Case Study) Thinking About Objects: Starting to Program the Classes for the Elevator Simulation.

9. Object-Oriented Programming.

Introduction. Superclasses and Subclasses. protected Members. Relationship between Superclass Objects and Subclass Objects. Constructors and Finalizers in Subclasses. Implicit Subclass-Object-to-Superclass-Object Conversion. Software Engineering with Inheritance. Composition vs. Inheritance. Case Study: Point, Circle, Cylinder. Introduction to Polymorphism. Type Fields and switch Statements. Dynamic Method Binding. final Methods and Classes. Abstract Superclasses and Concrete Classes. Polymorphism Examples. Case Study: A Payroll System Using Polymorphism. New Classes and Dynamic Binding. Case Study: Inheriting Interface and Implementation. Case Study: Creating and Using Interfaces. Inner Class Definitions. Notes on Inner Class Definitions. Type-Wrapper Classes for Primitive Types. (Optional Case Study) Thinking About Objects: Incorporating Inheritance into the Elevator Simulation. (Optional) Discovering Design Patterns: Introducing Creational, Structural and Behavioral Design Patterns.

10. Strings and Characters.

Introduction. Fundamentals of Characters and Strings. string Constructors. String Methods length, charAt and getChars. Comparing Strings. String Method hashCode. Locating Characters and Substrings in Strings. Extracting Substrings from Strings. Concatenating Strings. Miscellaneous String Methods. Using String Method valueOf. String Method intern. String8uffer Class. StringBuffer Constructors. StringBuffer Methods length, capacity, setLength and ensureCapacity. StringBuffer Methods charAt, setCharAt, getChars and reverse. StringBuffer append Methods. StringBuffer Insertion and Deletion Methods. Character Class Examples. Class StringTokenizer. Card Shuffling and Dealing Simulation. (Optional Case Study) Thinking About Objects: Event Handling.

11. Graphics and Java2D.

Introduction. Graphics Contexts and Graphics Objects. Color Control. Font Control. Drawing Lines, Rectangles and Ovals. Drawing Arcs. Drawing Polygons and Polylines. The Java2D API. Java2D Shapes. (Optional Case Study) Thinking About Objects: Designing Interfaces with the UML.

12. Graphical User Interface Components: Part 1.

Introduction. Swing Overview. JLabel. Event-Handling Model. JTextField and JPassraordField. JButton. JCheckBox and JRadioButton. JComboBOx. JList. Multiple-Selection Lists. Mouse Event Handling. Adapter Classes. Keyboard Event Handling. Layout Managers. Panels. (Optional Case Study) Thinking About Objects: Use Cases.

13. Graphical User Interface Components: Part 2.

Introduction. JTextArea. Creating a Customized Subclass of JPanel. Creating a Self-Contained Subclass of JPanel. JSlider. Windows. Designing Programs that Execute as Applets or Applications. Using Menus with Frames. Using JPopupMenus. Pluggable Look-and-Feel. Using JDesktopPane and JInternalFrame. Layout Managers. BoxLayout Layout Manager. CardLayout Layout Manager. GridBagLayout Layout Manager. GridBagConstraints Constants RELATIVE and REMAINDER. (Optional Case Study) Thinking About Objects: Model-View-Controller. (Optional) Discovering Design Patterns: Design Patterns Used in Packages java.awt and javax.swing.

14. Exception Handling.

Introduction. When Exception Handling Should Be Used. Other Error-Handling Techniques. Basics of Java Exception Handling. try Blocks. Throwing an Exception. Catching an Exception. Exception-Handling Example: Divide by Zero. Rethrowing an Exception. throws Clause. Constructors, Finalizers and Exception Handling. Exceptions and Inheritance. finally Block. Using printStackTrace and getMessage.

15. Multithreading.

Introduction. Class Thread: An Overview of the Thread Methods. Thread States: Life Cycle of a Thread. Thread Priorities and Thread Scheduling. Thread Synchronization. Producer/Consumer Relationship without Thread Synchronization. Producer/Consumer Relationship with Thread Synchronization. Producer/Consumer Relationship: The Circular Buffer. Daemon Threads. Rufmable Interface. Thread Groups. (Optional Case Study) Thinking About Objects: Multithreading. (Optional) Discovering Design Patterns: Concurrent Design Patterns.

16. Files and Streams.

Introduction. Data Hierarchy. Files and Streams. Creating a Sequential-Access File. Reading Data from a Sequential-Access File. Updating Sequential-Access Files. Random-Access Files. Creating a Random-Access File. Writing Data Randomly to a Random-Access File. Reading Data Sequentially from a Random-Access File. Example: A Transaction-Processing Program. Class File.

17. Networking.

Introduction. Manipulating URIs. Reading a File on a Web Server. Establishing a Simple Server Using Stream Sockets. Establishing a Simple Client Using Stream Sockets. Client/Server Interaction with Stream Socket Connections. Connectionless Client/Server Interaction with Datagrams. Client/Server Tic-Tac-Toe Using a Multithreaded Server. Security and the Network. DeitelMessenger Chat Server and Client. (Optional) Discovering Design Patterns: Design Patterns Used in Packages and

18. Multimedia: Images, Animation, Audio and Video.

Introduction. Loading, Displaying and Scaling Images. Animating a Series of Images. Customizing LogoAnimator via Applet Parameters. Image Maps. Loading and Playing Audio Clips. Internet and World Wide Web Resources.

19. Data Structures.

Introduction. Self-Referential Classes. Dynamic Memory Allocation. Linked Lists. Stacks. Queues. Trees.

20. Java Utilities Package and Bit Manipulation.

Introduction. vector Class and Enumeration Interface. Stack Class. Dictionary Class. Hashtable Class. properties Class. Random Class. Bit Manipulation and the Bitwise Operators. BitSet Class.

21. Collections.

Introduction. Collections Overview. Class Arrays. Interface Collection and Class Collections. Lists. Algorithms. Sets. Maps. Synchronization Wrappers. Unmodifiable Wrappers. Abstract Implementations. (Optional) Discovering Design Patterns: Design Patterns Used in Package java.util.

22. Java Media Framework and Java Sound (on CD).

Introduction. Playing Media. Formatting and Saving Captured Media. RTP Streaming. Java Sound. Playing Sampled Audio. Musical Instrument Digital Interface (MIDI). Internet and World Wide Web Resources. (Optional Case Study) Thinking About Objects: Animation and Sound in the View.

Appendix A. Demos.

Introduction. The Sites.

Appendix B. Java Resources.

Resources. Products. FAQs. Tutorials. Magazines. Java Applets. Multimedia. Newsgroups.

Appendix C. Operator Precedence Chart.
Appendix D. ASCII Character Set.
Appendix E. Number Systems (on CD).

Introduction. Abbreviating Binary Numbers as Octal Numbers and Hexadecimal Numbers. Converting Octal Numbers and Hexadecimal Numbers to Binary Numbers. Converting from Binary, Octal, or Hexadecimal to Decimal. Converting from Decimal to Binary, Octal, or Hexadecimal. Negative Binary Numbers: Two's Complement Notation.

Appendix F. Creating HTML Documentation with javadoc (on CD).

Introduction. Documentation Comments. Documenting Java Source Code. javadoc. Files Produced by javadoc.

Appendix G. Elevator Events and Listeners (on CD).

Introduction. Events. Listeners. Component Diagrams Revisited.

Appendix H. Elevator Model (on CD).

Introduction. Class ElevatorModel. Classes Location and Floor. Class Door. Class Button. Class ElevatorShaft. Classes Light and Bell. Class Elevator. Class Person. Component Diagrams Revisited. Conclusion.

Appendix I. Elevator View (on CD).

Introduction. Class Objects. Class Constants. Class constructor. Event Handling. Component Diagrams Revisited. Conclusion.

Appendix J. Career Opportunities (on CD).

Introduction. Resources for the Job Seeker. Online Opportunities for Employers. Recruiting Services. Career Sites. Internet and World Wide Web Resources.

Appendix K. Unicode® (on CD).

Introduction. Unicode Transformation Formats. Characters and Glyphs. Advantages/Disadvantages of Unicode. Unicode Consortium's Web Site. Using Unicode. Character Ranges.