PRACTICAL, EXAMPLE-RICH COVERAGE OF:Classes, Objects, Encapsulation, Inheritance, Polymorphism, Interfaces, Nested Classes Integrated OOP Case Studies: Time, GradeBook, Employee Industrial-Strength, 95-Page OOD/UML (R) 2 ATM Case Study JavaServer (TM) Faces, Ajax-Enabled Web Applications, Web Services, Networking JDBC (TM), SQL, Java DB, MySQL (R) Threads and the Concurrency APIs I/O, Types, Control Statements, Methods Arrays, Generics, Collections Exception Handling, Files GUI, Graphics, GroupLayout, JDIC Using the Debugger and the API Docs And more...VISIT WWW.DEITEL.COMFor information on Deitel's Dive Into (R) Series corporate training courses offered at customer sites worldwide (or write to deitel@deitel.com) Download code examples Check out the growing list of programming, Web 2.0, and software-related Resource Centers To receive updates for this book, subscribe to the free DEITEL (R) BUZZ ONLINE e-mail newsletter at www.deitel.com/newsletter/subscribe.html Read archived issues of the DEITEL (R) BUZZ ONLINEThe practicing programmer's DEITEL (R) guide to Java (TM) development and the Powerful Java (TM) PlatformWritten for programmers with a background in high-level language programming, this book applies the Deitel signature live-code approach to teaching programming and explores the Java language and Java APIs in depth. The book presents the concepts in the context of fully tested programs, complete with syntax shading, code highlighting, line-by-line code descriptions and program outputs. The book features 220 Java applications with over 18,000 lines of proven Java code, and hundreds of tips that will help you build robust applications.Start with an introduction to Java using an early classes and objects approach, then rapidly move on to more advanced topics, including GUI, graphics, exception handling, generics, collections, JDBC (TM), web-application development with JavaServer (TM) Faces, web services and more. You'll enjoy the Deitels' classic treatment of object-oriented programming and the OOD/UML (R) ATM case study, including a complete Java implementation. When you're finished, you'll have everything you need to build object-oriented Java applications.The DEITEL (R) Developer Series is designed for practicing programmers. The series presents focused treatments of emerging technologies, including Java (TM), C++, .NET, web services, Internet and web development and more. PRE-PUBLICATION REVIEWER TESTIMONIALS"Presenting software engineering side by side with core Java concepts is highly refreshing; gives readers insight into how professional software is developed."-Clark Richey (Java Champion), RABA Technologies, LLC."The quality of the design and code examples is second to none!"-Terrell Hull, Enterprise Architect"The JDBC chapter is very hands on. I like the fact that Java DB/Apache Derby is used in the examples, which makes it really simple to learn and understand JDBC."-Sandeep Konchady, Sun Microsystems"Equips you with the latest web application technologies. Examples are impressive and real! Want to develop a simple address locator with Ajax and JSF? Jump to Chapter 22."-Vadiraj Deshpande, Sun Microsystems"Covers web services with Java SE 6 and Java EE 5 in a real-life, example-based, friendly approach. The Deitel Web Services Resource Center is really good, even for advanced developers."-Sanjay Dhamankar, Sun Microsystems"Mandatory book for any serious Java EE developer looking for improved productivity: JSF development, visual web development and web services development have never been easier."-Ludovic Chapenois, Sun Microsystems"I teach Java programming and object-oriented analysis and design. The OOD/UML 2 case study is the best presentation of the ATM example I have seen."-Craig W. Slinkman, University of Texas-Arlington"Introduces OOP and UML 2 early. The conceptual level is perfect. No other book comes close to its quality of organization and presentation. The live-code approach to presenting exemplary code makes a big difference in the learning outcome."-Walt Bunch, Chapman University/
Les mer
Preface xxiiiBefore You Begin xxxiiiChapter 1: Introduction 11.1 Introduction 21.2 The Internet and the World Wide Web 31.3 History of C and C++ 31.4 History of Java 41.5 Java Class Libraries 41.6 Typical Java Development Environment 51.7 Notes about Java and Java for Programmers 81.8 Test-Driving a Java Application 91.9 Software Engineering Case Study: Introduction to Object Technology and the UML 131.10 Web 2.0 171.11 Software Technologies 181.12 Wrap-Up 191.13 Web Resources 20Chapter 2: Introduction to Java Applications 222.1 Introduction 232.2 A First Program in Java: Printing a Line of Text 232.3 Modifying Our First Java Program 292.4 Displaying Text with printf 322.5 Another Java Application: Adding Integers 332.6 Arithmetic 372.7 Decision Making: Equality and Relational Operators 392.8 (Optional) Software Engineering Case Study: Examining the Requirements Document 442.9 Wrap-Up 53Chapter 3: Introduction to Classes and Objects 543.1 Introduction 553.2 Classes, Objects, Methods and Instance Variables 553.3 Declaring a Class with a Method and Instantiating an Object of a Class 573.4 Declaring a Method with a Parameter 613.5 Instance Variables, set Methods and get Methods 643.6 Primitive Types vs. Reference Types 693.7 Initializing Objects with Constructors 703.8 Floating-Point Numbers and Type double 733.9 (Optional) Software Engineering Case Study: Identifying the Classes in a Requirements Document 783.10 Wrap-Up 86Chapter 4: Control Statements: Part 1 874.1 Introduction 884.2 Control Structures 884.3 if Single-Selection Statement 914.4 if...else Double-Selection Statement 914.5 while Repetition Statement 954.6 Counter-Controlled Repetition 964.7 Sentinel-Controlled Repetition 1004.8 Nested Control Statements 1064.9 Compound Assignment Operators 1094.10 Increment and Decrement Operators 1094.11 Primitive Types 1124.12 (Optional) Software Engineering Case Study: Identifying Class Attributes 1134.13 Wrap-Up 118Chapter 5: Control Statements: Part 2 1195.1 Introduction 1205.2 Essentials of Counter-Controlled Repetition 1205.3 for Repetition Statement 1225.4 Examples Using the for Statement 1255.5 do...while Repetition Statement 1305.6 switch Multiple-Selection Statement 1325.7 break and continue Statements 1395.8 Logical Operators 1415.9 (Optional) Software Engineering Case Study: Identifying Objects' States and Activities 1475.10 Wrap-Up 152Chapter 6: Methods: A Deeper Look 1536.1 Introduction 1546.2 Program Modules in Java 1556.3 static Methods, static Fields and Class Math 1556.4 Declaring Methods with Multiple Parameters 1586.5 Notes on Declaring and Using Methods 1626.6 Method-Call Stack and Activation Records 1636.7 Argument Promotion and Casting 1646.8 Java API Packages 1656.9 Case Study: Random-Number Generation 1676.10 Case Study: A Game of Chance (Introducing Enumerations) 1736.11 Scope of Declarations 1776.12 Method Overloading 1806.13 Introduction to Recursion 1836.14 Recursion Concepts 1846.15 Example Using Recursion: Factorials 1846.16 Example Using Recursion: Fibonacci Series 1876.17 Recursion and the Method-Call Stack 1906.18 Recursion vs. Iteration 1926.19 (Optional) Software Engineering Case Study: Identifying Class Operations 1946.20 Wrap-Up 201Chapter 7: Arrays 2027.1 Introduction 2037.2 Arrays 2037.3 Declaring and Creating Arrays 2057.4 Examples Using Arrays 2067.5 Case Study: Card Shuffling and Dealing Simulation 2157.6 Enhanced for Statement 2197.7 Passing Arrays to Methods 2207.8 Case Study: Class GradeBook Using an Array to Store Grades 2247.9 Multidimensional Arrays 2297.10 Case Study: Class GradeBook Using a Two-Dimensional Array 2337.11 Variable-Length Argument Lists 2397.12 Using Command-Line Arguments 2407.13 (Optional) Software Engineering Case Study: Collaboration Among Objects 2427.14 Wrap-Up 249Chapter 8: Classes and Objects: A Deeper Look 2518.1 Introduction 2528.2 Time Class Case Study 2538.3 Controlling Access to Members 2568.4 Referring to the Current Object's Members with the this Reference 2578.5 Time Class Case Study: Overloaded Constructors 2598.6 Default and No-Argument Constructors 2658.7 Notes on Set and Get Methods 2668.8 Composition 2678.9 Enumerations 2708.10 Garbage Collection and Method finalize 2738.11 static Class Members 2748.12 static Import 2788.13 final Instance Variables 2798.14 Software Reusability 2828.15 Data Abstraction and Encapsulation 2838.16 Time Class Case Study: Creating Packages 2848.17 Package Access 2908.18 (Optional) Software Engineering Case Study: Starting to Program the Classes of the ATM System 2918.19 Wrap-Up 297Chapter 9: Object-Oriented Programming: Inheritance 2989.1 Introduction 2999.2 Superclasses and Subclasses 3009.3 protected Members 3029.4 Relationship between Superclasses and Subclasses 3039.5 Constructors in Subclasses 3279.6 Software Engineering with Inheritance 3339.7 Object Class 3339.8 Wrap-Up 335Chapter 10: Object-Oriented Programming: Polymorphism 33610.1 Introduction 33710.2 Polymorphism Examples 33910.3 Demonstrating Polymorphic Behavior 34010.4 Abstract Classes and Methods 34210.5 Case Study: Payroll System Using Polymorphism 34510.6 final Methods and Classes 36010.7 Case Study: Creating and Using Interfaces 36110.8 (Optional) Software Engineering Case Study: Incorporating Inheritance into the ATM System 37310.9 Wrap-Up 380Chapter 11: GUI Components: Part 1 38111.1 Introduction 38211.2 Simple GUI-Based Input/Output with JOptionPane 38311.3 Overview of Swing Components 38611.4 Displaying Text and Images in a Window 38911.5 Text Fields and an Introduction to Event Handling with Nested Classes 39311.6 Common GUI Event Types and Listener Interfaces 40011.7 How Event Handling Works 40111.8 JButton 40411.9 Buttons That Maintain State 40711.10 JComboBox and Using an Anonymous Inner Class for Event Handling 41311.11 JList 41711.12 Multiple-Selection Lists 42011.13 Mouse Event Handling 42211.14 Adapter Classes 42711.15 JPanel Subclass for Drawing with the Mouse 43011.16 Key-Event Handling 43411.17 Layout Managers 43811.18 Using Panels to Manage More Complex Layouts 44711.19 JTextArea 44911.20 Wrap-Up 452Chapter 12: Graphics and Java 2D (TM) 45312.1 Introduction 45412.2 Graphics Contexts and Graphics Objects 45612.3 Color Control 45712.4 Font Control 46412.5 Drawing Lines, Rectangles and Ovals 47012.6 Drawing Arcs 47412.7 Drawing Polygons and Polylines 47612.8 Java 2D API 47912.9 Wrap-Up 486Chapter 13: Exception Handling 48713.1 Introduction 48813.2 Exception-Handling Overview 48913.3 Example: Divide by Zero without Exception Handling 49013.4 Example: Handling ArithmeticExceptions and InputMismatchExceptions 49213.5 When to Use Exception Handling 49713.6 Java Exception Hierarchy 49813.7 finally Block 50013.8 Stack Unwinding 50513.9 printStackTrace, getStackTrace and getMessage 50613.10 Chained Exceptions 50913.11 Declaring New Exception Types 51113.12 Preconditions and Postconditions 51213.13 Assertions 51213.14 Wrap-Up 514Chapter 14: Files and Streams 51514.1 Introduction 51614.2 Data Hierarchy 51714.3 Files and Streams 51914.4 Class File 52014.5 Sequential-Access Text Files 52514.6 Object Serialization 54014.7 Additional java.io Classes 55014.8 Opening Files with JFileChooser 55214.9 Wrap-Up 555Chapter 15: Generics 55615.1 Introduction 55715.2 Motivation for Generic Methods 55815.3 Generic Methods: Implementation and Compile-Time Translation 56015.4 Additional Compile-Time Translation Issues: Methods That Use a Type Parameter as the Return Type 56315.5 Overloading Generic Methods 56615.6 Generic Classes 56715.7 Raw Types 57715.8 Wildcards in Methods That Accept Type Parameters 58115.9 Generics and Inheritance: Notes 58515.10 Wrap-Up 58615.11 Internet and Web Resources 586Chapter 16: Collections 58716.1 Introduction 58816.2 Collections Overview 58916.3 Class Arrays 59016.4 Interface Collection and Class Collections 59316.5 Lists 59416.6 Collections Algorithms 60516.7 Stack Class of Package java.util 61816.8 Class PriorityQueue and Interface Queue 62116.9 Sets 62216.10 Maps 62516.11 Properties Class 62916.12 Synchronized Collections 63216.13 Unmodifiable Collections 63316.14 Abstract Implementations 63416.15 Wrap-Up 634Chapter 17: GUI Components: Part 2 63517.1 Introduction 63617.2 JSlider 63617.3 Windows: Additional Notes 64017.4 Using Menus with Frames 64117.5 JPopupMenu 64917.6 Pluggable Look-and-Feel 65217.7 JDesktopPane and JInternalFrame 65617.8 JTabbedPane 66017.9 Layout Managers: BoxLayout and GridBagLayout 66217.10 Wrap-Up 675Chapter 18: Multithreading 67618.1 Introduction 67718.2 Thread States: Life Cycle of a Thread 67918.3 Thread Priorities and Thread Scheduling 68118.4 Creating and Executing Threads 68318.5 Thread Synchronization 68718.6 Producer/Consumer Relationship without Synchronization 69618.7 Producer/Consumer Relationship: ArrayBlockingQueue 70318.8 Producer/Consumer Relationship with Synchronization 70618.9 Producer/Consumer Relationship: Bounded Buffers 71218.10 Producer/Consumer Relationship: The Lock and Condition Interfaces 72018.11 Multithreading with GUI 72618.12 Other Classes and Interfaces in java.util.concurrent 74118.13 Wrap-Up 741Chapter 19: Networking 74319.1 Introduction 74419.2 Manipulating URLs 74519.3 Reading a File on a Web Server 75019.4 Establishing a Simple Server Using Stream Sockets 75319.5 Establishing a Simple Client Using Stream Sockets 75519.6 Client/Server Interaction with Stream Socket Connections 75619.7 Connectionless Client/Server Interaction with Datagrams 76819.8 Client/Server Tic-Tac-Toe Using a Multithreaded Server 77519.9 Security and the Network 79019.10 [Web Bonus] Case Study: DeitelMessenger Server and Client 79019.11 Wrap-Up 790Chapter 20: Accessing Databases with JDBC 79120.1 Introduction 79220.2 Relational Databases 79320.3 Relational Database Overview: The books Database 79420.4 SQL 79720.5 Instructions for Installing MySQL and MySQL Connector/J 80620.6 Instructions for Setting Up a MySQL User Account 80720.7 Creating Database books in MySQL 80820.8 Manipulating Databases with JDBC 80920.9 RowSet Interface 82520.10 Java DB/Apache Derby 82820.11 PreparedStatements 82920.12 Stored Procedures 84420.13 Transaction Processing 84520.14 Wrap-Up 84620.15 Web Resources 846Chapter 21: JavaServer (TM) Faces Web Applications 84721.1 Introduction 84821.2 Simple HTTP Transactions 84921.3 Multitier Application Architecture 85221.4 Java Web Technologies 85321.5 Creating and Running a Simple Application in Netbeans 85721.6 JSF Components 87021.7 Session Tracking 88321.8 Wrap-Up 905Chapter 22: Ajax-Enabled JavaServer (TM) Faces Web Applications 90622.1 Introduction 90722.2 Accessing Databases in Web Applications 90722.3 Ajax-Enabled JSF Components 92022.4 Creating an Autocomplete Text Field and Using Virtual Forms 92222.5 Wrap-Up 932Chapter 23: JAX-WS Web Services 93323.1 Introduction 93423.2 Java Web Services Basics 93623.3 Creating, Publishing, Testing and Describing a Web Service 93623.4 Consuming a Web Service 94623.5 SOAP 95523.6 Session Tracking in Web Services 95723.7 Consuming a Database-Driven Web Service from a Web Application 97323.8 Passing an Object of a User-Defined Type to a Web Service 98223.9 Wrap-Up 992Chapter 24: Formatted Output 99324.1 Introduction 99424.2 Streams 99424.3 Formatting Output with printf 99424.4 Printing Integers 99524.5 Printing Floating-Point Numbers 99624.6 Printing Strings and Characters 99824.7 Printing Dates and Times 99924.8 Other Conversion Characters 100224.9 Printing with Field Widths and Precisions 100324.10 Using Flags in the printf Format String 100524.11 Printing with Argument Indices 100924.12 Printing Literals and Escape Sequences 101024.13 Formatting Output with Class Formatter 101024.14 Wrap-Up 1012Chapter 25: Strings, Characters and Regular Expressions 101325.1 Introduction 101425.2 Fundamentals of Characters and Strings 101425.3 Class String 101525.4 Class StringBuilder 102825.5 Class Character 103525.6 Class StringTokenizer 103925.7 Regular Expressions, Class Pattern and Class Matcher 104125.8 Wrap-Up 1049Appendix A: Operator Precedence Chart 1050A.1 Operator Precedence 1050Appendix B: ASCII Character Set 1052Appendix C: Keywords and Reserved Words 1053Appendix D: Primitive Types 1054Appendix E: GroupLayout 1055E.1 Introduction 1055E.2 GroupLayout Basics 1055E.3 Building a ColorChooser 1056E.4 GroupLayout Web Resources 1066Appendix F: Java Desktop Integration Components (JDIC) 1067F.1 Introduction 1067F.2 Splash Screens 1067F.3 Desktop Class 1069F.4 Tray Icons 1072F.5 JDIC Incubator Projects 1072F.6 JDIC Demos 1072Appendix G: Using the Java API Documentation 1073G.1 Introduction 1073G.2 Navigating the Java API 1074Appendix H: ATM Case Study Code 1082H.1 ATM Case Study Implementation 1082H.2 Class ATM 1083H.3 Class Screen 1088H.4 Class Keypad 1089H.5 Class CashDispenser 1090H.6 Class DepositSlot 1091H.7 Class Account 1092H.8 Class BankDatabase 1094H.9 Class Transaction 1097H.10 Class BalanceInquiry 1098H.11 Class Withdrawal 1098H.12 Class Deposit 1103H.13 Class ATMCaseStudy 1106H.14 Wrap-Up 1106Appendix I: UML 2: Additional Diagram Types 1107I.1 Introduction 1107I.2 Additional Diagram Types 1107Appendix J: Using the Debugger 1109J.1 Introduction 1110J.2 Breakpoints and the run, stop, cont and print Commands 1110J.3 The print and set Commands 1114J.4 Controlling Execution Using the step, step up and next Commands 1116J.5 The watch Command 1119J.6 The clear Command 1121J.7 Wrap-Up 1124Index 1125
Les mer

Produktdetaljer

ISBN
9780137001293
Publisert
2009-02-26
Utgiver
Vendor
Prentice Hall
Vekt
1830 gr
Høyde
233 mm
Bredde
177 mm
Dybde
60 mm
Aldersnivå
05, U
Språk
Product language
Engelsk
Format
Product format
Heftet
Antall sider
1200

Biographical note

Paul J. Deitel andDr. Harvey M. Deitel are the founders of Deitel & Associates, Inc., the internationally recognized programming languages content-creation, corporate-training and Internet business development organization. The Deitels have written many international best-selling programming languages professional books and textbooks that millions of people worldwide have used to master Java (TM), C++, C, C#, XML, Visual Basic (R), Perl, Python and Internet and web programming.