Submit Search
Upload
Java how to_program__7th_edition
•
0 likes
•
271 views
A
ABDUmomo
Follow
uploded for computer science students by abdu
Read less
Read more
Software
Report
Share
Report
Share
1 of 1705
Download now
Download to read offline
Recommended
Machine Vision Toolbox for MATLAB (Relese 3)
Machine Vision Toolbox for MATLAB (Relese 3)
CHIH-PEI WEN
Java : How to Program - 7e
Java : How to Program - 7e
CHIH-PEI WEN
Robotics Toolbox for MATLAB (Relese 9)
Robotics Toolbox for MATLAB (Relese 9)
CHIH-PEI WEN
MarvelSoft PayrollAdmin Configuration and User Guide
MarvelSoft PayrollAdmin Configuration and User Guide
Ranganath Shivaram
Programming
Programming
Aravindharamanan S
School software
School software
Ranganath Shivaram
46600726 vijeo-quick-start-tutorial-v710
46600726 vijeo-quick-start-tutorial-v710
croyf
Outlook 2007 Tips and Tricks
Outlook 2007 Tips and Tricks
outlookbill
Recommended
Machine Vision Toolbox for MATLAB (Relese 3)
Machine Vision Toolbox for MATLAB (Relese 3)
CHIH-PEI WEN
Java : How to Program - 7e
Java : How to Program - 7e
CHIH-PEI WEN
Robotics Toolbox for MATLAB (Relese 9)
Robotics Toolbox for MATLAB (Relese 9)
CHIH-PEI WEN
MarvelSoft PayrollAdmin Configuration and User Guide
MarvelSoft PayrollAdmin Configuration and User Guide
Ranganath Shivaram
Programming
Programming
Aravindharamanan S
School software
School software
Ranganath Shivaram
46600726 vijeo-quick-start-tutorial-v710
46600726 vijeo-quick-start-tutorial-v710
croyf
Outlook 2007 Tips and Tricks
Outlook 2007 Tips and Tricks
outlookbill
Oscom23 old
Oscom23 old
Alexander Vilcapaza Chavez
Sql developer usermanual_en
Sql developer usermanual_en
Aravindharamanan S
Mysql tutorial-excerpt-5.1-en
Mysql tutorial-excerpt-5.1-en
Rifky Rachman
Endversion1 skriptum characterization of miscellaneous multi parametrical sil...
Endversion1 skriptum characterization of miscellaneous multi parametrical sil...
EjderCevher
Paladin Network Administrators Guide
Paladin Network Administrators Guide
hanniw79
QAD Database Definitions Technical Reference - QAD2013.1EE
QAD Database Definitions Technical Reference - QAD2013.1EE
Vinh Nguyen
c
c
MasterCode.vn
SAP_HANA_Modeling_Guide_for_SAP_HANA_Studio_en
SAP_HANA_Modeling_Guide_for_SAP_HANA_Studio_en
Jim Miller, MBA
Lab view manual
Lab view manual
Mara Landa Guzman
Red book Blueworks Live
Red book Blueworks Live
Francesco Maria Rivera
Morph xit
Morph xit
Ahmed Farag
MFG/PRO QAD Reporting Framework Document Guide
MFG/PRO QAD Reporting Framework Document Guide
Vinh Nguyen
Force dotcom apex code developers guide
Force dotcom apex code developers guide
slipnslideslideshare
ManageEngine ServiceDesk Plus Admin Guide
ManageEngine ServiceDesk Plus Admin Guide
ServiceDesk Plus
Wn o pos_user_guide
Wn o pos_user_guide
JOHNPATRICKBERNARDIN1
Microsoft excel 2010 product guide final
Microsoft excel 2010 product guide final
Carol de la Plaza
1ux2y54tcwomq2gtx7pd
1ux2y54tcwomq2gtx7pd
Juanfe1978
Zeta Producer 9 CMS online manual
Zeta Producer 9 CMS online manual
Uwe Keim
Ale i doc-complete-tutorial
Ale i doc-complete-tutorial
Aneesh Shamsudeen
Tortoise svn 1.7-en
Tortoise svn 1.7-en
sreeharichepuri
OAF Developer Guide 13.1.3
OAF Developer Guide 13.1.3
crwanare
LSI_SAS2008_Manual_v100.pdf
LSI_SAS2008_Manual_v100.pdf
Mutia Eliza, S.Pd
More Related Content
What's hot
Oscom23 old
Oscom23 old
Alexander Vilcapaza Chavez
Sql developer usermanual_en
Sql developer usermanual_en
Aravindharamanan S
Mysql tutorial-excerpt-5.1-en
Mysql tutorial-excerpt-5.1-en
Rifky Rachman
Endversion1 skriptum characterization of miscellaneous multi parametrical sil...
Endversion1 skriptum characterization of miscellaneous multi parametrical sil...
EjderCevher
Paladin Network Administrators Guide
Paladin Network Administrators Guide
hanniw79
QAD Database Definitions Technical Reference - QAD2013.1EE
QAD Database Definitions Technical Reference - QAD2013.1EE
Vinh Nguyen
c
c
MasterCode.vn
SAP_HANA_Modeling_Guide_for_SAP_HANA_Studio_en
SAP_HANA_Modeling_Guide_for_SAP_HANA_Studio_en
Jim Miller, MBA
Lab view manual
Lab view manual
Mara Landa Guzman
Red book Blueworks Live
Red book Blueworks Live
Francesco Maria Rivera
Morph xit
Morph xit
Ahmed Farag
MFG/PRO QAD Reporting Framework Document Guide
MFG/PRO QAD Reporting Framework Document Guide
Vinh Nguyen
Force dotcom apex code developers guide
Force dotcom apex code developers guide
slipnslideslideshare
ManageEngine ServiceDesk Plus Admin Guide
ManageEngine ServiceDesk Plus Admin Guide
ServiceDesk Plus
Wn o pos_user_guide
Wn o pos_user_guide
JOHNPATRICKBERNARDIN1
Microsoft excel 2010 product guide final
Microsoft excel 2010 product guide final
Carol de la Plaza
1ux2y54tcwomq2gtx7pd
1ux2y54tcwomq2gtx7pd
Juanfe1978
Zeta Producer 9 CMS online manual
Zeta Producer 9 CMS online manual
Uwe Keim
Ale i doc-complete-tutorial
Ale i doc-complete-tutorial
Aneesh Shamsudeen
What's hot
(19)
Oscom23 old
Oscom23 old
Sql developer usermanual_en
Sql developer usermanual_en
Mysql tutorial-excerpt-5.1-en
Mysql tutorial-excerpt-5.1-en
Endversion1 skriptum characterization of miscellaneous multi parametrical sil...
Endversion1 skriptum characterization of miscellaneous multi parametrical sil...
Paladin Network Administrators Guide
Paladin Network Administrators Guide
QAD Database Definitions Technical Reference - QAD2013.1EE
QAD Database Definitions Technical Reference - QAD2013.1EE
c
c
SAP_HANA_Modeling_Guide_for_SAP_HANA_Studio_en
SAP_HANA_Modeling_Guide_for_SAP_HANA_Studio_en
Lab view manual
Lab view manual
Red book Blueworks Live
Red book Blueworks Live
Morph xit
Morph xit
MFG/PRO QAD Reporting Framework Document Guide
MFG/PRO QAD Reporting Framework Document Guide
Force dotcom apex code developers guide
Force dotcom apex code developers guide
ManageEngine ServiceDesk Plus Admin Guide
ManageEngine ServiceDesk Plus Admin Guide
Wn o pos_user_guide
Wn o pos_user_guide
Microsoft excel 2010 product guide final
Microsoft excel 2010 product guide final
1ux2y54tcwomq2gtx7pd
1ux2y54tcwomq2gtx7pd
Zeta Producer 9 CMS online manual
Zeta Producer 9 CMS online manual
Ale i doc-complete-tutorial
Ale i doc-complete-tutorial
Similar to Java how to_program__7th_edition
Tortoise svn 1.7-en
Tortoise svn 1.7-en
sreeharichepuri
OAF Developer Guide 13.1.3
OAF Developer Guide 13.1.3
crwanare
LSI_SAS2008_Manual_v100.pdf
LSI_SAS2008_Manual_v100.pdf
Mutia Eliza, S.Pd
End note
End note
Rapassak Hetthong
software-eng.pdf
software-eng.pdf
fellahi1
Aplplication server instalacion
Aplplication server instalacion
hkaczuba
By d ui_styleguide_2012_fp35
By d ui_styleguide_2012_fp35
Александр Луганский
R Exts
R Exts
Ajay Ohri
Python_Programming_and_Numerical_Methods_A_Guide_for_Engineers_and.pdf
Python_Programming_and_Numerical_Methods_A_Guide_for_Engineers_and.pdf
jankoabel2022
Implementing ibm tivoli service request manager v7.1 service catalog sg247613
Implementing ibm tivoli service request manager v7.1 service catalog sg247613
Banking at Ho Chi Minh city
Ibm tivoli intelligent think dynamic orchestrator pre proof of-concept cookbo...
Ibm tivoli intelligent think dynamic orchestrator pre proof of-concept cookbo...
Banking at Ho Chi Minh city
2226 v3 rev_a
2226 v3 rev_a
Probity2001
X cart 430-manual
X cart 430-manual
madtgw
Ibm info sphere datastage data flow and job design
Ibm info sphere datastage data flow and job design
divjeev
Hibernate Reference
Hibernate Reference
Saverio Menin
Tellurium 0.6.0 User Guide
Tellurium 0.6.0 User Guide
John.Jian.Fang
html-css-bootstrap-javascript-and-jquery
html-css-bootstrap-javascript-and-jquery
MD. NURUL ISLAM
Tape automation with ibm e server xseries servers redp0415
Tape automation with ibm e server xseries servers redp0415
Banking at Ho Chi Minh city
R intro
R intro
sougats
R Intro
R Intro
Ajay Ohri
Similar to Java how to_program__7th_edition
(20)
Tortoise svn 1.7-en
Tortoise svn 1.7-en
OAF Developer Guide 13.1.3
OAF Developer Guide 13.1.3
LSI_SAS2008_Manual_v100.pdf
LSI_SAS2008_Manual_v100.pdf
End note
End note
software-eng.pdf
software-eng.pdf
Aplplication server instalacion
Aplplication server instalacion
By d ui_styleguide_2012_fp35
By d ui_styleguide_2012_fp35
R Exts
R Exts
Python_Programming_and_Numerical_Methods_A_Guide_for_Engineers_and.pdf
Python_Programming_and_Numerical_Methods_A_Guide_for_Engineers_and.pdf
Implementing ibm tivoli service request manager v7.1 service catalog sg247613
Implementing ibm tivoli service request manager v7.1 service catalog sg247613
Ibm tivoli intelligent think dynamic orchestrator pre proof of-concept cookbo...
Ibm tivoli intelligent think dynamic orchestrator pre proof of-concept cookbo...
2226 v3 rev_a
2226 v3 rev_a
X cart 430-manual
X cart 430-manual
Ibm info sphere datastage data flow and job design
Ibm info sphere datastage data flow and job design
Hibernate Reference
Hibernate Reference
Tellurium 0.6.0 User Guide
Tellurium 0.6.0 User Guide
html-css-bootstrap-javascript-and-jquery
html-css-bootstrap-javascript-and-jquery
Tape automation with ibm e server xseries servers redp0415
Tape automation with ibm e server xseries servers redp0415
R intro
R intro
R Intro
R Intro
Recently uploaded
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
Delhi Call girls
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
masabamasaba
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Bert Jan Schrijver
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
Willy Marroquin (WillyDevNET)
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
Jim McKeeth
Define the academic and professional writing..pdf
Define the academic and professional writing..pdf
PearlKirahMaeRagusta1
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
Presentation.STUDIO
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto
masabamasaba
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
WSO2
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
masabamasaba
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
Jhone kinadey
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
masabamasaba
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
AmarnathKambale
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
masabamasaba
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
masabamasaba
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
masabamasaba
Harnessing ChatGPT - Elevating Productivity in Today's Agile Environment
Harnessing ChatGPT - Elevating Productivity in Today's Agile Environment
VictorSzoltysek
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
masabamasaba
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
OnePlan Solutions
Recently uploaded
(20)
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
Define the academic and professional writing..pdf
Define the academic and professional writing..pdf
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
Harnessing ChatGPT - Elevating Productivity in Today's Agile Environment
Harnessing ChatGPT - Elevating Productivity in Today's Agile Environment
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Java how to_program__7th_edition
1.
2.
Table of Contents Copyright.....................................................................................................
1 Deitel® Series Page..................................................................................... 5 Preface........................................................................................................ 8 Before You Begin....................................................................................... 21 Chapter 1. Introduction to Computers, the Internet and the Web.............. 28 Section 1.1. Introduction............................................................................................................................................................... 29 Section 1.2. What Is a Computer?................................................................................................................................................. 31 Section 1.3. Computer Organization............................................................................................................................................. 31 Section 1.4. Early Operating Systems........................................................................................................................................... 32 Section 1.5. Personal, Distributed and Client/Server Computing............................................................................................... 33 Section 1.6. The Internet and the World Wide Web..................................................................................................................... 33 Section 1.7. Machine Languages, Assembly Languages and High-Level Languages................................................................... 34 Section 1.8. History of C and C++................................................................................................................................................. 35 Section 1.9. History of Java........................................................................................................................................................... 36 Section 1.10. Java Class Libraries................................................................................................................................................. 36 Section 1.11. Fortran, COBOL, Pascal and Ada............................................................................................................................. 37 Section 1.12. BASIC, Visual Basic, Visual C++, C# and .NET...................................................................................................... 38 Section 1.13. Typical Java Development Environment................................................................................................................ 38 Section 1.14. Notes about Java and Java How to Program, 7/e................................................................................................... 42 Section 1.15. Test-Driving a Java Application.............................................................................................................................. 43 Section 1.16. Software Engineering Case Study: Introduction to Object Technology and the UML........................................... 47 Section 1.17. Web 2.0..................................................................................................................................................................... 52 Section 1.18. Software Technologies............................................................................................................................................. 53 Section 1.19. Wrap-Up................................................................................................................................................................... 54 Section 1.20. Web Resources........................................................................................................................................................ 55 Summary....................................................................................................................................................................................... 57 Terminology.................................................................................................................................................................................. 60 Self-Review Exercises.................................................................................................................................................................... 61 Answers to Self-Review Exercises................................................................................................................................................ 62 Exercises........................................................................................................................................................................................ 62 Chapter 2. Introduction to Java Applications............................................ 64 Section 2.1. Introduction............................................................................................................................................................... 65 Section 2.2. A First Program in Java: Printing a Line of Text..................................................................................................... 65 Section 2.3. Modifying Our First Java Program........................................................................................................................... 72 Section 2.4. Displaying Text with printf....................................................................................................................................... 75 Section 2.5. Another Java Application: Adding Integers............................................................................................................. 76 Section 2.6. Memory Concepts...................................................................................................................................................... 81 Section 2.7. Arithmetic................................................................................................................................................................. 82 Section 2.8. Decision Making: Equality and Relational Operators............................................................................................. 85 Section 2.9. (Optional) Software Engineering Case Study: Examining the Requirements Document...................................... 90 Section 2.10. Wrap-Up................................................................................................................................................................ 100 Summary..................................................................................................................................................................................... 100 Terminology................................................................................................................................................................................ 103 Self-Review Exercises.................................................................................................................................................................. 104 Answers to Self-Review Exercises............................................................................................................................................... 105 Exercises...................................................................................................................................................................................... 107 Chapter 3. Introduction to Classes and Objects......................................... 111 Section 3.1. Introduction............................................................................................................................................................. 112 Section 3.2. Classes, Objects, Methods and Instance Variables................................................................................................. 112 Section 3.3. Declaring a Class with a Method and Instantiating an Object of a Class............................................................... 114 Section 3.4. Declaring a Method with a Parameter.................................................................................................................... 118 Section 3.5. Instance Variables, set Methods and get Methods.................................................................................................. 121 Section 3.6. Primitive Types vs. Reference Types....................................................................................................................... 126 Section 3.7. Initializing Objects with Constructors..................................................................................................................... 127 Section 3.8. Floating-Point Numbers and Type double............................................................................................................. 130 Java™ How to Program, Seventh Edition Java™ How to Program, Seventh Edition Java™ How to Program, Seventh Edition By H. M. Deitel - Deitel & Associates, Inc., P. J. Deitel - Deitel & Associates, Inc. ISBN: 9780136085676 Publisher: Prentice Hall Prepared for Peter Disney, Safari ID: peterwaltd@wokeh.com Licensed by Peter Disney Print Publication Date: 2006/12/27 User number: 1839029 © 2009 Safari Books Online, LLC. This PDF is made available for personal use only during the relevant subscription term, subject to the Safari Terms of Service. Any other use requires prior written consent from the copyright owner. Unauthorized use, reproduction and/or distribution are strictly prohibited and violate applicable laws. All rights reserved.
3.
Section 3.9. (Optional)
GUI and Graphics Case Study: Using Dialog Boxes............................................................................. 135 Section 3.10. (Optional) Software Engineering Case Study: Identifying the Classes in a Requirements Document............... 138 Section 3.11. Wrap-Up................................................................................................................................................................. 146 Summary..................................................................................................................................................................................... 146 Terminology................................................................................................................................................................................. 149 Self-Review Exercises.................................................................................................................................................................. 150 Answers to Self-Review Exercises............................................................................................................................................... 151 Exercises...................................................................................................................................................................................... 152 Chapter 4. Control Statements: Part 1...................................................... 154 Section 4.1. Introduction............................................................................................................................................................. 155 Section 4.2. Algorithms............................................................................................................................................................... 155 Section 4.3. Pseudocode.............................................................................................................................................................. 156 Section 4.4. Control Structures................................................................................................................................................... 156 Section 4.5. if Single-Selection Statement.................................................................................................................................. 159 Section 4.6. if...else Double-Selection Statement....................................................................................................................... 160 Section 4.7. while Repetition Statement..................................................................................................................................... 165 Section 4.8. Formulating Algorithms: Counter-Controlled Repetition..................................................................................... 166 Section 4.9. Formulating Algorithms: Sentinel-Controlled Repetition...................................................................................... 171 Section 4.10. Formulating Algorithms: Nested Control Statements.......................................................................................... 179 Section 4.11. Compound Assignment Operators........................................................................................................................ 184 Section 4.12. Increment and Decrement Operators................................................................................................................... 185 Section 4.13. Primitive Types...................................................................................................................................................... 188 Section 4.14. (Optional) GUI and Graphics Case Study: Creating Simple Drawings................................................................ 188 Section 4.15. (Optional) Software Engineering Case Study: Identifying Class Attributes......................................................... 193 Section 4.16. Wrap-Up................................................................................................................................................................. 197 Summary..................................................................................................................................................................................... 198 Terminology................................................................................................................................................................................ 203 Self-Review Exercises................................................................................................................................................................. 204 Answers to Self-Review Exercises.............................................................................................................................................. 206 Exercises...................................................................................................................................................................................... 207 Chapter 5. Control Statements: Part 2...................................................... 213 Section 5.1. Introduction............................................................................................................................................................. 214 Section 5.2. Essentials of Counter-Controlled Repetition.......................................................................................................... 214 Section 5.3. for Repetition Statement......................................................................................................................................... 216 Section 5.4. Examples Using the for Statement......................................................................................................................... 220 Section 5.5. do...while Repetition Statement............................................................................................................................. 225 Section 5.6. switch Multiple-Selection Statement...................................................................................................................... 226 Section 5.7. break and continue Statements.............................................................................................................................. 234 Section 5.8. Logical Operators.................................................................................................................................................... 236 Section 5.9. Structured Programming Summary....................................................................................................................... 242 Section 5.10. (Optional) GUI and Graphics Case Study: Drawing Rectangles and Ovals......................................................... 247 Section 5.11. (Optional) Software Engineering Case Study: Identifying Objects’ States and Activities................................... 250 Section 5.12. Wrap-Up................................................................................................................................................................ 254 Summary..................................................................................................................................................................................... 255 Terminology................................................................................................................................................................................ 259 Self-Review Exercises................................................................................................................................................................. 260 Answers to Self-Review Exercises............................................................................................................................................... 261 Exercises...................................................................................................................................................................................... 262 Chapter 6. Methods: A Deeper Look........................................................ 266 Section 6.1. Introduction............................................................................................................................................................. 267 Section 6.2. Program Modules in Java....................................................................................................................................... 268 Section 6.3. static Methods, static Fields and Class Math......................................................................................................... 269 Section 6.4. Declaring Methods with Multiple Parameters....................................................................................................... 272 Section 6.5. Notes on Declaring and Using Methods................................................................................................................. 276 Section 6.6. Method-Call Stack and Activation Records............................................................................................................ 277 Section 6.7. Argument Promotion and Casting.......................................................................................................................... 278 Section 6.8. Java API Packages................................................................................................................................................... 279 Section 6.9. Case Study: Random-Number Generation............................................................................................................. 281 Section 6.10. Case Study: A Game of Chance (Introducing Enumerations).............................................................................. 287 Java™ How to Program, Seventh Edition Java™ How to Program, Seventh Edition Java™ How to Program, Seventh Edition By H. M. Deitel - Deitel & Associates, Inc., P. J. Deitel - Deitel & Associates, Inc. ISBN: 9780136085676 Publisher: Prentice Hall Prepared for Peter Disney, Safari ID: peterwaltd@wokeh.com Licensed by Peter Disney Print Publication Date: 2006/12/27 User number: 1839029 © 2009 Safari Books Online, LLC. This PDF is made available for personal use only during the relevant subscription term, subject to the Safari Terms of Service. Any other use requires prior written consent from the copyright owner. Unauthorized use, reproduction and/or distribution are strictly prohibited and violate applicable laws. All rights reserved.
4.
Section 6.11. Scope
of Declarations............................................................................................................................................. 291 Section 6.12. Method Overloading............................................................................................................................................. 294 Section 6.13. (Optional) GUI and Graphics Case Study: Colors and Filled Shapes.................................................................. 297 Section 6.14. (Optional) Software Engineering Case Study: Identifying Class Operations...................................................... 300 Section 6.15. Wrap-Up................................................................................................................................................................ 307 Summary..................................................................................................................................................................................... 308 Terminology................................................................................................................................................................................. 311 Self-Review Exercises.................................................................................................................................................................. 312 Answers to Self-Review Exercises............................................................................................................................................... 314 Exercises...................................................................................................................................................................................... 316 Chapter 7. Arrays.................................................................................... 322 Section 7.1. Introduction............................................................................................................................................................. 323 Section 7.2. Arrays...................................................................................................................................................................... 323 Section 7.3. Declaring and Creating Arrays................................................................................................................................ 325 Section 7.4. Examples Using Arrays........................................................................................................................................... 326 Section 7.5. Case Study: Card Shuffling and Dealing Simulation.............................................................................................. 335 Section 7.6. Enhanced for Statement......................................................................................................................................... 339 Section 7.7. Passing Arrays to Methods..................................................................................................................................... 340 Section 7.8. Case Study: Class GradeBook Using an Array to Store Grades............................................................................. 344 Section 7.9. Multidimensional Arrays........................................................................................................................................ 349 Section 7.10. Case Study: Class GradeBook Using a Two-Dimensional Array.......................................................................... 353 Section 7.11. Variable-Length Argument Lists........................................................................................................................... 359 Section 7.12. Using Command-Line Arguments........................................................................................................................ 360 Section 7.13. (Optional) GUI and Graphics Case Study: Drawing Arcs..................................................................................... 362 Section 7.14. (Optional) Software Engineering Case Study: Collaboration Among Objects..................................................... 365 Section 7.15. Wrap-Up................................................................................................................................................................. 373 Summary..................................................................................................................................................................................... 374 Terminology................................................................................................................................................................................ 376 Self-Review Exercises.................................................................................................................................................................. 377 Answers to Self-Review Exercises.............................................................................................................................................. 378 Exercises...................................................................................................................................................................................... 378 Special Section: Building Your Own Computer......................................................................................................................... 388 Chapter 8. Classes and Objects: A Deeper Look....................................... 395 Section 8.1. Introduction............................................................................................................................................................ 396 Section 8.2. Time Class Case Study............................................................................................................................................ 397 Section 8.3. Controlling Access to Members.............................................................................................................................. 401 Section 8.4. Referring to the Current Object’s Members with the this Reference.................................................................... 402 Section 8.5. Time Class Case Study: Overloaded Constructors................................................................................................. 404 Section 8.6. Default and No-Argument Constructors................................................................................................................ 409 Section 8.7. Notes on Set and Get Methods................................................................................................................................ 410 Section 8.8. Composition............................................................................................................................................................. 411 Section 8.9. Enumerations.......................................................................................................................................................... 414 Section 8.10. Garbage Collection and Method finalize............................................................................................................... 417 Section 8.11. static Class Members............................................................................................................................................. 418 Section 8.12. static Import.......................................................................................................................................................... 423 Section 8.13. final Instance Variables......................................................................................................................................... 424 Section 8.14. Software Reusability............................................................................................................................................. 426 Section 8.15. Data Abstraction and Encapsulation.................................................................................................................... 427 Section 8.16. Time Class Case Study: Creating Packages.......................................................................................................... 429 Section 8.17. Package Access...................................................................................................................................................... 434 Section 8.18. (Optional) GUI and Graphics Case Study: Using Objects with Graphics............................................................ 436 Section 8.19. (Optional) Software Engineering Case Study: Starting to Program the Classes of the ATM System................. 439 Section 8.20. Wrap-Up............................................................................................................................................................... 445 Summary..................................................................................................................................................................................... 445 Terminology................................................................................................................................................................................ 448 Self-Review Exercise................................................................................................................................................................... 449 Answers to Self-Review Exercise................................................................................................................................................ 450 Exercises...................................................................................................................................................................................... 450 Chapter 9. Object-Oriented Programming: Inheritance.......................... 454 Java™ How to Program, Seventh Edition Java™ How to Program, Seventh Edition Java™ How to Program, Seventh Edition By H. M. Deitel - Deitel & Associates, Inc., P. J. Deitel - Deitel & Associates, Inc. ISBN: 9780136085676 Publisher: Prentice Hall Prepared for Peter Disney, Safari ID: peterwaltd@wokeh.com Licensed by Peter Disney Print Publication Date: 2006/12/27 User number: 1839029 © 2009 Safari Books Online, LLC. This PDF is made available for personal use only during the relevant subscription term, subject to the Safari Terms of Service. Any other use requires prior written consent from the copyright owner. Unauthorized use, reproduction and/or distribution are strictly prohibited and violate applicable laws. All rights reserved.
5.
Section 9.1. Introduction.............................................................................................................................................................
455 Section 9.2. Superclasses and Subclasses................................................................................................................................... 456 Section 9.3. protected Members................................................................................................................................................. 458 Section 9.4. Relationship between Superclasses and Subclasses.............................................................................................. 459 Section 9.5. Constructors in Subclasses..................................................................................................................................... 483 Section 9.6. Software Engineering with Inheritance................................................................................................................. 489 Section 9.7. Object Class............................................................................................................................................................. 490 Section 9.8. (Optional) GUI and Graphics Case Study: Displaying Text and Images Using Labels......................................... 492 Section 9.9. Wrap-Up................................................................................................................................................................. 494 Summary..................................................................................................................................................................................... 495 Terminology................................................................................................................................................................................ 496 Self-Review Exercises................................................................................................................................................................. 496 Answers to Self-Review Exercises............................................................................................................................................... 497 Exercises...................................................................................................................................................................................... 497 Chapter 10. Object-Oriented Programming: Polymorphism.................... 498 Section 10.1. Introduction........................................................................................................................................................... 499 Section 10.2. Polymorphism Examples...................................................................................................................................... 501 Section 10.3. Demonstrating Polymorphic Behavior................................................................................................................. 502 Section 10.4. Abstract Classes and Methods.............................................................................................................................. 505 Section 10.5. Case Study: Payroll System Using Polymorphism............................................................................................... 507 Section 10.6. final Methods and Classes..................................................................................................................................... 522 Section 10.7. Case Study: Creating and Using Interfaces........................................................................................................... 523 Section 10.8. (Optional) GUI and Graphics Case Study: Drawing with Polymorphism........................................................... 535 Section 10.9. (Optional) Software Engineering Case Study: Incorporating Inheritance into the ATM System....................... 537 Section 10.10. Wrap-Up.............................................................................................................................................................. 545 Summary..................................................................................................................................................................................... 545 Terminology................................................................................................................................................................................ 547 Self-Review Exercises................................................................................................................................................................. 548 Answers to Self-Review Exercises.............................................................................................................................................. 548 Exercises...................................................................................................................................................................................... 548 Chapter 11. GUI Components: Part 1........................................................ 550 Section 11.1. Introduction............................................................................................................................................................ 551 Section 11.2. Simple GUI-Based Input/Output with JOptionPane............................................................................................ 552 Section 11.3. Overview of Swing Components............................................................................................................................ 555 Section 11.4. Displaying Text and Images in a Window............................................................................................................. 558 Section 11.5. Text Fields and an Introduction to Event Handling with Nested Classes............................................................ 563 Section 11.6. Common GUI Event Types and Listener Interfaces............................................................................................. 569 Section 11.7. How Event Handling Works.................................................................................................................................. 572 Section 11.8. JButton................................................................................................................................................................... 573 Section 11.9. Buttons That Maintain State.................................................................................................................................. 577 Section 11.10. JComboBox and Using an Anonymous Inner Class for Event Handling........................................................... 583 Section 11.11. JList....................................................................................................................................................................... 587 Section 11.12. Multiple-Selection Lists....................................................................................................................................... 589 Section 11.13. Mouse Event Handling......................................................................................................................................... 592 Section 11.14. Adapter Classes..................................................................................................................................................... 597 Section 11.15. JPanel Subclass for Drawing with the Mouse..................................................................................................... 600 Section 11.16. Key-Event Handling............................................................................................................................................. 604 Section 11.17. Layout Managers.................................................................................................................................................. 607 Section 11.18. Using Panels to Manage More Complex Layouts................................................................................................. 617 Section 11.19. JTextArea.............................................................................................................................................................. 618 Section 11.20. Wrap-Up............................................................................................................................................................... 621 Summary..................................................................................................................................................................................... 622 Terminology................................................................................................................................................................................ 628 Self-Review Exercises................................................................................................................................................................. 630 Answers to Self-Review Exercises............................................................................................................................................... 631 Exercises...................................................................................................................................................................................... 631 Chapter 12. Graphics and Java 2D™........................................................ 636 Section 12.1. Introduction........................................................................................................................................................... 637 Section 12.2. Graphics Contexts and Graphics Objects............................................................................................................. 639 Java™ How to Program, Seventh Edition Java™ How to Program, Seventh Edition Java™ How to Program, Seventh Edition By H. M. Deitel - Deitel & Associates, Inc., P. J. Deitel - Deitel & Associates, Inc. ISBN: 9780136085676 Publisher: Prentice Hall Prepared for Peter Disney, Safari ID: peterwaltd@wokeh.com Licensed by Peter Disney Print Publication Date: 2006/12/27 User number: 1839029 © 2009 Safari Books Online, LLC. This PDF is made available for personal use only during the relevant subscription term, subject to the Safari Terms of Service. Any other use requires prior written consent from the copyright owner. Unauthorized use, reproduction and/or distribution are strictly prohibited and violate applicable laws. All rights reserved.
6.
Section 12.3. Color
Control......................................................................................................................................................... 640 Section 12.4. Font Control.......................................................................................................................................................... 647 Section 12.5. Drawing Lines, Rectangles and Ovals................................................................................................................... 653 Section 12.6. Drawing Arcs......................................................................................................................................................... 657 Section 12.7. Drawing Polygons and Polylines........................................................................................................................... 660 Section 12.8. Java 2D API........................................................................................................................................................... 663 Section 12.9. Wrap-Up................................................................................................................................................................ 670 Summary..................................................................................................................................................................................... 670 Terminology................................................................................................................................................................................ 672 Self-Review Exercises.................................................................................................................................................................. 673 Answers to Self-Review Exercises............................................................................................................................................... 674 Exercises...................................................................................................................................................................................... 674 Chapter 13. Exception Handling.............................................................. 679 Section 13.1. Introduction........................................................................................................................................................... 680 Section 13.2. Exception-Handling Overview.............................................................................................................................. 681 Section 13.3. Example: Divide by Zero without Exception Handling........................................................................................ 682 Section 13.4. Example: Handling ArithmeticExceptions and InputMismatchExceptions....................................................... 684 Section 13.5. When to Use Exception Handling......................................................................................................................... 689 Section 13.6. Java Exception Hierarchy..................................................................................................................................... 690 Section 13.7. finally Block........................................................................................................................................................... 693 Section 13.8. Stack Unwinding................................................................................................................................................... 697 Section 13.9. printStackTrace, getStackTrace and getMessage................................................................................................. 699 Section 13.10. Chained Exceptions.............................................................................................................................................. 701 Section 13.11. Declaring New Exception Types.......................................................................................................................... 703 Section 13.12. Preconditions and Postconditions....................................................................................................................... 704 Section 13.13. Assertions............................................................................................................................................................. 705 Section 13.14. Wrap-Up.............................................................................................................................................................. 706 Summary..................................................................................................................................................................................... 707 Terminology................................................................................................................................................................................. 710 Self-Review Exercises.................................................................................................................................................................. 710 Answers to Self-Review Exercises................................................................................................................................................ 711 Exercises...................................................................................................................................................................................... 712 Chapter 14. Files and Streams.................................................................. 713 Section 14.1. Introduction............................................................................................................................................................ 714 Section 14.2. Data Hierarchy....................................................................................................................................................... 715 Section 14.3. Files and Streams................................................................................................................................................... 717 Section 14.4. Class File................................................................................................................................................................ 719 Section 14.5. Sequential-Access Text Files................................................................................................................................. 723 Section 14.6. Object Serialization............................................................................................................................................... 739 Section 14.7. Additional java.io Classes...................................................................................................................................... 748 Section 14.8. Opening Files with JFileChooser.......................................................................................................................... 750 Section 14.9. Wrap-Up................................................................................................................................................................ 754 Summary..................................................................................................................................................................................... 754 Terminology................................................................................................................................................................................ 756 Self-Review Exercises.................................................................................................................................................................. 757 Answers to Self-Review Exercises............................................................................................................................................... 759 Exercises...................................................................................................................................................................................... 760 Chapter 15. Recursion............................................................................. 764 Section 15.1. Introduction........................................................................................................................................................... 765 Section 15.2. Recursion Concepts............................................................................................................................................... 766 Section 15.3. Example Using Recursion: Factorials................................................................................................................... 767 Section 15.4. Example Using Recursion: Fibonacci Series......................................................................................................... 770 Section 15.5. Recursion and the Method-Call Stack................................................................................................................... 773 Section 15.6. Recursion vs. Iteration........................................................................................................................................... 774 Section 15.7. Towers of Hanoi..................................................................................................................................................... 776 Section 15.8. Fractals................................................................................................................................................................... 779 Section 15.9. Recursive Backtracking......................................................................................................................................... 790 Section 15.10. Wrap-Up.............................................................................................................................................................. 790 Section 15.11. Internet and Web Resources................................................................................................................................ 791 Java™ How to Program, Seventh Edition Java™ How to Program, Seventh Edition Java™ How to Program, Seventh Edition By H. M. Deitel - Deitel & Associates, Inc., P. J. Deitel - Deitel & Associates, Inc. ISBN: 9780136085676 Publisher: Prentice Hall Prepared for Peter Disney, Safari ID: peterwaltd@wokeh.com Licensed by Peter Disney Print Publication Date: 2006/12/27 User number: 1839029 © 2009 Safari Books Online, LLC. This PDF is made available for personal use only during the relevant subscription term, subject to the Safari Terms of Service. Any other use requires prior written consent from the copyright owner. Unauthorized use, reproduction and/or distribution are strictly prohibited and violate applicable laws. All rights reserved.
7.
Summary..................................................................................................................................................................................... 792 Terminology................................................................................................................................................................................ 794 Self-Review
Exercises.................................................................................................................................................................. 794 Answers to Self-Review Exercises............................................................................................................................................... 795 Exercises...................................................................................................................................................................................... 795 Chapter 16. Searching and Sorting.......................................................... 800 Section 16.1. Introduction........................................................................................................................................................... 801 Section 16.2. Searching Algorithms........................................................................................................................................... 802 Section 16.3. Sorting Algorithms................................................................................................................................................. 811 Section 16.4. Invariants.............................................................................................................................................................. 826 Section 16.5. Wrap-Up................................................................................................................................................................ 827 Summary..................................................................................................................................................................................... 828 Terminology................................................................................................................................................................................ 829 Self-Review Exercises................................................................................................................................................................. 830 Answers to Self-Review Exercises.............................................................................................................................................. 830 Exercises..................................................................................................................................................................................... 830 Chapter 17. Data Structures..................................................................... 833 Section 17.1. Introduction........................................................................................................................................................... 834 Section 17.2. Type-Wrapper Classes for Primitive Types........................................................................................................... 835 Section 17.3. Autoboxing and Auto-Unboxing........................................................................................................................... 835 Section 17.4. Self-Referential Classes......................................................................................................................................... 836 Section 17.5. Dynamic Memory Allocation................................................................................................................................. 837 Section 17.6. Linked Lists............................................................................................................................................................ 837 Section 17.7. Stacks..................................................................................................................................................................... 848 Section 17.8. Queues................................................................................................................................................................... 852 Section 17.9. Trees....................................................................................................................................................................... 854 Section 17.10. Wrap-Up............................................................................................................................................................... 861 Summary..................................................................................................................................................................................... 861 Terminology................................................................................................................................................................................ 863 Self-Review Exercises................................................................................................................................................................. 864 Answers to Self-Review Exercises.............................................................................................................................................. 865 Exercises..................................................................................................................................................................................... 866 Chapter 18. Generics............................................................................... 886 Section 18.1. Introduction........................................................................................................................................................... 887 Section 18.2. Motivation for Generic Methods.......................................................................................................................... 888 Section 18.3. Generic Methods: Implementation and Compile-Time Translation................................................................... 890 Section 18.4. Additional Compile-Time Translation Issues: Methods That Use a Type Parameter as the Return Type......... 893 Section 18.5. Overloading Generic Methods.............................................................................................................................. 896 Section 18.6. Generic Classes...................................................................................................................................................... 897 Section 18.7. Raw Types.............................................................................................................................................................. 907 Section 18.8. Wildcards in Methods That Accept Type Parameters........................................................................................... 911 Section 18.9. Generics and Inheritance: Notes........................................................................................................................... 915 Section 18.10. Wrap-Up.............................................................................................................................................................. 916 Section 18.11. Internet and Web Resources................................................................................................................................ 916 Summary..................................................................................................................................................................................... 916 Terminology................................................................................................................................................................................. 919 Self-Review Exercises.................................................................................................................................................................. 919 Answers to Self-Review Exercises............................................................................................................................................... 919 Exercises..................................................................................................................................................................................... 920 Chapter 19. Collections............................................................................ 921 Section 19.1. Introduction........................................................................................................................................................... 922 Section 19.2. Collections Overview............................................................................................................................................. 923 Section 19.3. Class Arrays........................................................................................................................................................... 924 Section 19.4. Interface Collection and Class Collections............................................................................................................ 927 Section 19.5. Lists....................................................................................................................................................................... 928 Section 19.6. Collections Algorithms.......................................................................................................................................... 939 Section 19.7. Stack Class of Package java.util............................................................................................................................. 952 Section 19.8. Class PriorityQueue and Interface Queue............................................................................................................. 955 Section 19.9. Sets......................................................................................................................................................................... 956 Java™ How to Program, Seventh Edition Java™ How to Program, Seventh Edition Java™ How to Program, Seventh Edition By H. M. Deitel - Deitel & Associates, Inc., P. J. Deitel - Deitel & Associates, Inc. ISBN: 9780136085676 Publisher: Prentice Hall Prepared for Peter Disney, Safari ID: peterwaltd@wokeh.com Licensed by Peter Disney Print Publication Date: 2006/12/27 User number: 1839029 © 2009 Safari Books Online, LLC. This PDF is made available for personal use only during the relevant subscription term, subject to the Safari Terms of Service. Any other use requires prior written consent from the copyright owner. Unauthorized use, reproduction and/or distribution are strictly prohibited and violate applicable laws. All rights reserved.
8.
Section 19.10. Maps.....................................................................................................................................................................
959 Section 19.11. Properties Class.................................................................................................................................................... 964 Section 19.12. Synchronized Collections..................................................................................................................................... 967 Section 19.13. Unmodifiable Collections.................................................................................................................................... 967 Section 19.14. Abstract Implementations................................................................................................................................... 968 Section 19.15. Wrap-Up.............................................................................................................................................................. 968 Summary..................................................................................................................................................................................... 969 Terminology................................................................................................................................................................................ 972 Self-Review Exercises.................................................................................................................................................................. 973 Answers to Self-Review Exercises............................................................................................................................................... 973 Exercises...................................................................................................................................................................................... 974 Chapter 20. Introduction to Java Applets................................................ 976 Section 20.1. Introduction........................................................................................................................................................... 977 Section 20.2. Sample Applets Provided with the JDK............................................................................................................... 977 Section 20.3. Simple Java Applet: Drawing a String................................................................................................................. 982 Section 20.4. Applet Life-Cycle Methods................................................................................................................................... 987 Section 20.5. Initializing an Instance Variable with Method init.............................................................................................. 988 Section 20.6. Sandbox Security Model....................................................................................................................................... 990 Section 20.7. Internet and Web Resources................................................................................................................................ 990 Section 20.8. Wrap-Up................................................................................................................................................................ 991 Summary..................................................................................................................................................................................... 991 Terminology................................................................................................................................................................................ 993 Self-Review Exercise................................................................................................................................................................... 993 Answers to Self-Review Exercise................................................................................................................................................ 993 Exercises...................................................................................................................................................................................... 994 Chapter 21. Multimedia: Applets and Applications.................................. 995 Section 21.1. Introduction........................................................................................................................................................... 996 Section 21.2. Loading, Displaying and Scaling Images.............................................................................................................. 997 Section 21.3. Animating a Series of Images............................................................................................................................. 1000 Section 21.4. Image Maps......................................................................................................................................................... 1005 Section 21.5. Loading and Playing Audio Clips........................................................................................................................ 1008 Section 21.6. Playing Video and Other Media with Java Media Framework............................................................................ 1011 Section 21.7. Wrap-Up...............................................................................................................................................................1016 Section 21.8. Web Resources.....................................................................................................................................................1016 Summary.................................................................................................................................................................................... 1017 Terminology...............................................................................................................................................................................1018 Self-Review Exercises................................................................................................................................................................1019 Answers to Self-Review Exercises.............................................................................................................................................1019 Exercises....................................................................................................................................................................................1020 Special Section: Challenging Multimedia Projects...................................................................................................................1020 Chapter 22. GUI Components: Part 2.....................................................1023 Section 22.1. Introduction.........................................................................................................................................................1024 Section 22.2. JSlider................................................................................................................................................................. 1024 Section 22.3. Windows: Additional Notes................................................................................................................................ 1028 Section 22.4. Using Menus with Frames.................................................................................................................................. 1029 Section 22.5. JPopupMenu....................................................................................................................................................... 1037 Section 22.6. Pluggable Look-and-Feel.................................................................................................................................... 1040 Section 22.7. JDesktopPane and JInternalFrame....................................................................................................................1044 Section 22.8. JTabbedPane.......................................................................................................................................................1048 Section 22.9. Layout Managers: BoxLayout and GridBagLayout............................................................................................ 1050 Section 22.10. Wrap-Up............................................................................................................................................................1063 Summary................................................................................................................................................................................... 1064 Terminology.............................................................................................................................................................................. 1065 Self-Review Exercises................................................................................................................................................................1067 Answers to Self-Review Exercises.............................................................................................................................................1067 Exercises....................................................................................................................................................................................1068 Chapter 23. Multithreading................................................................... 1070 Section 23.1. Introduction......................................................................................................................................................... 1071 Section 23.2. Thread States: Life Cycle of a Thread................................................................................................................. 1073 Java™ How to Program, Seventh Edition Java™ How to Program, Seventh Edition Java™ How to Program, Seventh Edition By H. M. Deitel - Deitel & Associates, Inc., P. J. Deitel - Deitel & Associates, Inc. ISBN: 9780136085676 Publisher: Prentice Hall Prepared for Peter Disney, Safari ID: peterwaltd@wokeh.com Licensed by Peter Disney Print Publication Date: 2006/12/27 User number: 1839029 © 2009 Safari Books Online, LLC. This PDF is made available for personal use only during the relevant subscription term, subject to the Safari Terms of Service. Any other use requires prior written consent from the copyright owner. Unauthorized use, reproduction and/or distribution are strictly prohibited and violate applicable laws. All rights reserved.
9.
Section 23.3. Thread
Priorities and Thread Scheduling...........................................................................................................1075 Section 23.4. Creating and Executing Threads.........................................................................................................................1077 Section 23.5. Thread Synchronization......................................................................................................................................1081 Section 23.6. Producer/Consumer Relationship without Synchronization............................................................................ 1090 Section 23.7. Producer/Consumer Relationship: ArrayBlockingQueue..................................................................................1097 Section 23.8. Producer/Consumer Relationship with Synchronization..................................................................................1100 Section 23.9. Producer/Consumer Relationship: Bounded Buffers........................................................................................ 1106 Section 23.10. Producer/Consumer Relationship: The Lock and Condition Interfaces.......................................................... 1114 Section 23.11. Multithreading with GUI....................................................................................................................................1120 Section 23.12. Other Classes and Interfaces in java.util.concurrent........................................................................................ 1135 Section 23.13. Wrap-Up............................................................................................................................................................. 1135 Summary.................................................................................................................................................................................... 1136 Terminology............................................................................................................................................................................... 1142 Self-Review Exercises................................................................................................................................................................ 1143 Answers to Self-Review Exercises............................................................................................................................................. 1144 Exercises.................................................................................................................................................................................... 1144 Chapter 24. Networking......................................................................... 1146 Section 24.1. Introduction......................................................................................................................................................... 1147 Section 24.2. Manipulating URLs.............................................................................................................................................1148 Section 24.3. Reading a File on a Web Server........................................................................................................................... 1153 Section 24.4. Establishing a Simple Server Using Stream Sockets........................................................................................... 1157 Section 24.5. Establishing a Simple Client Using Stream Sockets........................................................................................... 1158 Section 24.6. Client/Server Interaction with Stream Socket Connections............................................................................... 1159 Section 24.7. Connectionless Client/Server Interaction with Datagrams................................................................................. 1171 Section 24.8. Client/Server Tic-Tac-Toe Using a Multithreaded Server.................................................................................. 1178 Section 24.9. Security and the Network.................................................................................................................................... 1193 Section 24.10. [Web Bonus] Case Study: DeitelMessenger Server and Client......................................................................... 1194 Section 24.11. Wrap-Up............................................................................................................................................................. 1194 Summary....................................................................................................................................................................................1194 Terminology...............................................................................................................................................................................1196 Self-Review Exercises................................................................................................................................................................ 1197 Answers to Self-Review Exercises............................................................................................................................................. 1197 Exercises.................................................................................................................................................................................... 1198 Chapter 25. Accessing Databases with JDBC.......................................... 1201 Section 25.1. Introduction.........................................................................................................................................................1202 Section 25.2. Relational Databases...........................................................................................................................................1203 Section 25.3. Relational Database Overview: The books Database......................................................................................... 1204 Section 25.4. SQL...................................................................................................................................................................... 1207 Section 25.5. Instructions for installing MySQL and MySQL Connector/J............................................................................. 1216 Section 25.6. Instructions for Setting Up a MySQL User Account........................................................................................... 1217 Section 25.7. Creating Database books in MySQL....................................................................................................................1218 Section 25.8. Manipulating Databases with JDBC................................................................................................................... 1219 Section 25.9. RowSet Interface................................................................................................................................................. 1236 Section 25.10. Java DB/Apache Derby..................................................................................................................................... 1239 Section 25.11. PreparedStatements...........................................................................................................................................1254 Section 25.12. Stored Procedures..............................................................................................................................................1256 Section 25.13. Transaction Processing......................................................................................................................................1256 Section 25.14. Wrap-Up.............................................................................................................................................................1257 Section 25.15. Web Resources and Recommended Readings.................................................................................................. 1257 Summary....................................................................................................................................................................................1259 Terminology.............................................................................................................................................................................. 1264 Self-Review Exercise................................................................................................................................................................. 1265 Answers to Self-Review Exercise.............................................................................................................................................. 1265 Exercises.................................................................................................................................................................................... 1265 Chapter 26. Web Applications: Part 1.....................................................1268 Section 26.1. Introduction.........................................................................................................................................................1269 Section 26.2. Simple HTTP Transactions.................................................................................................................................1270 Section 26.3. Multitier Application Architecture......................................................................................................................1272 Section 26.4. Java Web Technologies.......................................................................................................................................1273 Java™ How to Program, Seventh Edition Java™ How to Program, Seventh Edition Java™ How to Program, Seventh Edition By H. M. Deitel - Deitel & Associates, Inc., P. J. Deitel - Deitel & Associates, Inc. ISBN: 9780136085676 Publisher: Prentice Hall Prepared for Peter Disney, Safari ID: peterwaltd@wokeh.com Licensed by Peter Disney Print Publication Date: 2006/12/27 User number: 1839029 © 2009 Safari Books Online, LLC. This PDF is made available for personal use only during the relevant subscription term, subject to the Safari Terms of Service. Any other use requires prior written consent from the copyright owner. Unauthorized use, reproduction and/or distribution are strictly prohibited and violate applicable laws. All rights reserved.
10.
Section 26.5. Creating
and Running a Simple Application in Java Studio Creator 2..............................................................1276 Section 26.6. JSF Components................................................................................................................................................. 1293 Section 26.7. Session Tracking................................................................................................................................................. 1308 Section 26.8. Wrap-Up.............................................................................................................................................................. 1336 Section 26.9. Web Resources.................................................................................................................................................... 1337 Summary................................................................................................................................................................................... 1338 Terminology.............................................................................................................................................................................. 1346 Self-Review Exercises................................................................................................................................................................ 1347 Answers to Self-Review Exercises............................................................................................................................................. 1347 Exercises.................................................................................................................................................................................... 1348 Chapter 27. Web Applications: Part 2.................................................... 1349 Section 27.1. Introduction......................................................................................................................................................... 1350 Section 27.2. Accessing Databases in Web Applications.......................................................................................................... 1351 Section 27.3. Ajax-Enabled JSF Components.......................................................................................................................... 1363 Section 27.4. AutoComplete Text Field and Virtual Forms...................................................................................................... 1365 Section 27.5. Google Maps Map Viewer Component................................................................................................................ 1374 Section 27.6. Wrap-Up.............................................................................................................................................................. 1386 Section 27.7. Web Resources.................................................................................................................................................... 1386 Summary....................................................................................................................................................................................1387 Terminology.............................................................................................................................................................................. 1389 Self-Review Exercises................................................................................................................................................................ 1390 Answers to Self-Review Exercises............................................................................................................................................. 1390 Exercises.....................................................................................................................................................................................1391 Chapter 28. JAX-WS Web Services, Web 2.0 and Mash-Ups.................. 1392 Section 28.1. Introduction......................................................................................................................................................... 1393 Section 28.2. Java Web Services Basics.................................................................................................................................... 1396 Section 28.3. Creating, Publishing, Testing and Describing a Web Service............................................................................ 1396 Section 28.4. Consuming a Web Service.................................................................................................................................. 1406 Section 28.5. SOAP.................................................................................................................................................................... 1416 Section 28.6. Session Tracking in Web Services.......................................................................................................................1418 Section 28.7. Consuming a Database-Driven Web Service from a Web Application.............................................................. 1434 Section 28.8. Passing an Object of a User-Defined Type to a Web Service............................................................................. 1443 Section 28.9. Wrap-Up.............................................................................................................................................................. 1454 Section 28.10. Web Resources.................................................................................................................................................. 1454 Summary....................................................................................................................................................................................1455 Terminology.............................................................................................................................................................................. 1460 Self-Review Exercises................................................................................................................................................................ 1460 Answers to Self-Review Exercises............................................................................................................................................. 1461 Exercises.................................................................................................................................................................................... 1461 Chapter 29. Formatted Output............................................................... 1463 Section 29.1. Introduction......................................................................................................................................................... 1464 Section 29.2. Streams................................................................................................................................................................ 1464 Section 29.3. Formatting Output with printf............................................................................................................................ 1465 Section 29.4. Printing Integers................................................................................................................................................. 1465 Section 29.5. Printing Floating-Point Numbers....................................................................................................................... 1466 Section 29.6. Printing Strings and Characters......................................................................................................................... 1468 Section 29.7. Printing Dates and Times.................................................................................................................................... 1469 Section 29.8. Other Conversion Characters.............................................................................................................................. 1472 Section 29.9. Printing with Field Widths and Precisions......................................................................................................... 1474 Section 29.10. Using Flags in the printf Format String............................................................................................................ 1476 Section 29.11. Printing with Argument Indices........................................................................................................................ 1479 Section 29.12. Printing Literals and Escape Sequences........................................................................................................... 1480 Section 29.13. Formatting Output with Class Formatter..........................................................................................................1481 Section 29.14. Wrap-Up............................................................................................................................................................ 1482 Summary................................................................................................................................................................................... 1482 Terminology.............................................................................................................................................................................. 1484 Self-Review Exercises................................................................................................................................................................ 1484 Answers to Self-Review Exercises............................................................................................................................................. 1485 Exercises.................................................................................................................................................................................... 1486 Java™ How to Program, Seventh Edition Java™ How to Program, Seventh Edition Java™ How to Program, Seventh Edition By H. M. Deitel - Deitel & Associates, Inc., P. J. Deitel - Deitel & Associates, Inc. ISBN: 9780136085676 Publisher: Prentice Hall Prepared for Peter Disney, Safari ID: peterwaltd@wokeh.com Licensed by Peter Disney Print Publication Date: 2006/12/27 User number: 1839029 © 2009 Safari Books Online, LLC. This PDF is made available for personal use only during the relevant subscription term, subject to the Safari Terms of Service. Any other use requires prior written consent from the copyright owner. Unauthorized use, reproduction and/or distribution are strictly prohibited and violate applicable laws. All rights reserved.
Download now