0% found this document useful (0 votes)
12 views176 pages

Java Programming Exercises Volume One Language Fundamentals and Core Concepts 1st Edition Christian Ullenboom Online Reading

The document is a promotional description for the book 'Java Programming Exercises Volume One: Language Fundamentals and Core Concepts' by Christian Ullenboom, which is available for direct download in various formats. It includes a high rating of 4.9 out of 5.0 based on 49 reviews and outlines the contents and structure of the book, including exercises and suggested solutions. Additionally, it provides links to other related programming books and information about the publisher and copyright details.

Uploaded by

dinorasimon3676
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views176 pages

Java Programming Exercises Volume One Language Fundamentals and Core Concepts 1st Edition Christian Ullenboom Online Reading

The document is a promotional description for the book 'Java Programming Exercises Volume One: Language Fundamentals and Core Concepts' by Christian Ullenboom, which is available for direct download in various formats. It includes a high rating of 4.9 out of 5.0 based on 49 reviews and outlines the contents and structure of the book, including exercises and suggested solutions. Additionally, it provides links to other related programming books and information about the publisher and copyright details.

Uploaded by

dinorasimon3676
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 176

Java Programming Exercises Volume One Language

Fundamentals and Core Concepts 1st Edition Christian


Ullenboom direct download

https://ebookname.com/product/java-programming-exercises-volume-one-
language-fundamentals-and-core-concepts-1st-edition-christian-
ullenboom/

★★★★★
4.9 out of 5.0 (49 reviews )

Access PDF Now

ebookname.com
Java Programming Exercises Volume One Language Fundamentals
and Core Concepts 1st Edition Christian Ullenboom

EBOOK

Available Formats

■ PDF eBook Study Guide Ebook

EXCLUSIVE 2025 ACADEMIC EDITION – LIMITED RELEASE

Available Instantly Access Library


Instant digital products (PDF, ePub, MOBI) available
Download now and explore formats that suit you...

Programming Language Design Concepts 1st Edition Findlay

https://ebookname.com/product/programming-language-design-
concepts-1st-edition-findlay/

ebookname.com

Effective Java Programming Language Guide 1st Edition


Joshua Bloch

https://ebookname.com/product/effective-java-programming-language-
guide-1st-edition-joshua-bloch/

ebookname.com

Java programming comprehensive concepts and techniques 3rd


Edition Gary B. Shelly

https://ebookname.com/product/java-programming-comprehensive-concepts-
and-techniques-3rd-edition-gary-b-shelly/

ebookname.com

Blood Noir Anita Blake Vampire Hunter 16 1st Edition


Laurell K. Hamilton

https://ebookname.com/product/blood-noir-anita-blake-vampire-
hunter-16-1st-edition-laurell-k-hamilton/

ebookname.com
Surgical Anatomy and Techniques to the Spine 2nd Edition
Daniel H. Kim Et Al.

https://ebookname.com/product/surgical-anatomy-and-techniques-to-the-
spine-2nd-edition-daniel-h-kim-et-al/

ebookname.com

Multicultural Psychology 6th Edition Jeffery Scott Mio

https://ebookname.com/product/multicultural-psychology-6th-edition-
jeffery-scott-mio/

ebookname.com

Electrical insulation for rotating machines 1st Edition


Greg Stone

https://ebookname.com/product/electrical-insulation-for-rotating-
machines-1st-edition-greg-stone/

ebookname.com

Pauline Frommer s Washington D C Pauline Frommer Guides


1st Edition James T. Yenckel

https://ebookname.com/product/pauline-frommer-s-washington-d-c-
pauline-frommer-guides-1st-edition-james-t-yenckel/

ebookname.com

Organizational Behaviour 1st Edition Daniel King

https://ebookname.com/product/organizational-behaviour-1st-edition-
daniel-king/

ebookname.com
The Heroic Slave A Cultural and Critical Edition Frederick
Douglass (Editor)

https://ebookname.com/product/the-heroic-slave-a-cultural-and-
critical-edition-frederick-douglass-editor/

ebookname.com
Captain CiaoCiao

Features:
Designed cover image: Mai Loan Nguyen Duy, Rheinwerk Verlag GmbH

First edition published 2025


by CRC Press
2385 NW Executive Center Drive, Suite 320, Boca Raton FL 33431

and by CRC Press


4 Park Square, Milton Park, Abingdon, Oxon, OX14 4RN

CRC Press is an imprint of Taylor & Francis Group, LLC

©2023 Christian Ullenboom. First published in the German language under the title “Captain CiaoCiao erobert Java”
(ISBN 978‑3‑8362‑8427‑1) by Rheinwerk Verlag GmbH, Bonn, Germany.

Reasonable efforts have been made to publish reliable data and information, but the author and publisher cannot
assume responsibility for the validity of all materials or the consequences of their use. The authors and publishers
have attempted to trace the copyright holders of all material reproduced in this publication and apologize to
copyright holders if permission to publish in this form has not been obtained. If any copyright material has not been
acknowledged please write and let us know so we may rectify in any future reprint.

Except as permitted under U.S. Copyright Law, no part of this book may be reprinted, reproduced, transmitted, or
utilized in any form by any electronic, mechanical, or other means, now known or hereafter invented, including
photocopying, microfilming, and recording, or in any information storage or retrieval system, without written
permission from the publishers.

For permission to photocopy or use material electronically from this work, access www.copyright.com or contact the
Copyright Clearance Center, Inc. (CCC), 222 Rosewood Drive, Danvers, MA 01923, 978‑750‑8400. For works that are
not available on CCC please contact [email protected]

Trademark notice: Product or corporate names may be trademarks or registered trademarks and are used only for
identification and explanation without intent to infringe.

ISBN: 978‑1‑032‑59397‑5 (hbk)


ISBN: 978‑1‑032‑57984‑9 (pbk)
ISBN: 978‑1‑003‑45450‑2 (ebk)

DOI: 10.1201/9781003454502

Typeset in Times
by codeMantra

Access the Support Material: https://routledge.com/9781032579849


Contents

About the Author xv

Introduction 1
Previous Knowledge and Target Audience 1
Working with This Book 2
The Suggested Solutions 2
Use of This Book 3
Required Software 3
Used Java Version in the Book 4
JVM 4
Development Environment 4
Conventions 4
Helping Captain CiaoCiao and Bonny Brain 5

1 Introduction to the Java Ecosystem 6


Bytecode and JVM 6
Porting Java Programs ⭑ 6
Tools for Java Developers 7
Get to Know Error Messages of the IDE ⭑ 7
Suggested Solutions 8
Porting Java Programs ⭑ 8
Get to Know Error Messages of the IDE ⭑ 8

2 Imperative Programming 9
Screen Output 9
Learn about the SVG Specification 9
Write an SVG Circle on the Console ⭑ 10
Variables and Data Types 11
Access Variables and Output Their Assignments ⭑ 12
Quiz: Value Ranges ⭑ 12
Quiz: Does This Add Up? ⭑⭑⭑ 12
Generate Random Circles ⭑ 13
Quiz: Dazed and Confused ⭑ 14
Process User Input ⭑ 14
Expressions, Operands, and Operators 14
Quiz: Check In-Between ⭑ 14
Check If Loot Can Be Shared Fairly ⭑ 15
Do Two Numbers Share the Same Digit? ⭑⭑ 15
Convert Currency Amount to Coins ⭑⭑ 15
One Bottle of Rum, Ten Bottles of Rum ⭑ 16
Quiz: The Zero Effect ⭑ 17

v
vi Contents

Control Flow 18
Payday ⭑ 18
Quiz: Wrong Branching ⭑ 18
Convert Liters ⭑⭑ 19
Create SVG Circles with Random Colors ⭑ 19
Quiz: To Which Block Does the Else Belong? ⭑⭑ 20
Quiz: Recognize Negative Days and Hours ⭑ 20
Evaluate Input Strings for Approval ⭑ 20
Rewrite Switch Statement to Switch Expression ⭑ 21
Loops 21
Create Rotated SVG Rectangles ⭑ 21
Create SVG‑Pearl‑Chain ⭑ 22
Sum Numbers from the Command Line ⭑ 23
Go through a Mathematical Phenomenon ⭑ 24
Quiz: How Many Stars? ⭑ 24
Calculate Products for Faculties ⭑ 25
Determine If a Number Is Formed by Factorial ⭑ 25
Find the Smallest and Largest Digit of a Number ⭑ 26
Quiz: Not Like This from 1 to 100 ⭑⭑ 27
A Flag in the Wind through Nested Loops ⭑ 28
Output Simple Chessboard ⭑ 28
It’s Christmastime: Displaying Trees with Ornaments ⭑ 29
Draw Fishy Stitching Motifs ⭑ 30
Trying Instead of Thinking ⭑⭑ 31
Get the Number of Digits of a Number ⭑⭑ 32
Methods 33
Drawing Hearts ⭑ 33
Implement Overloaded Line Methods ⭑ 34
Standing Straight ⭑ 34
Create a Multiplication Table ⭑ 35
Cistercian Numerals Script ⭑⭑⭑ 36
Quiz: What Does Ding‑Dong Do? (Recursion) ⭑⭑ 37
Quiz: Repdigit (Recursion) ⭑⭑ 37
Calculate Collatz Sequence (Recursion) ⭑ 38
Ancient Egyptian Multiplication (Recursion) ⭑⭑ 38
Suggested Solutions 40
Write an SVG Circle on the Console ⭑ 40
Access Variables and Output Their Assignments 41
Quiz: Value Ranges 42
Quiz: Does This Add Up? 43
Generate Random Circles 43
Quiz: Dazed and Confused 44
Process User Input 44
Quiz: Check In-Between 44
Check If Loot Can Be Shared Fairly 45
Do Two Numbers Share the Same Digit? 45
Convert Currency Amount to Coins 46
One Bottle of Rum, Ten Bottles of Rum 47
Quiz: The Zero Effect 47
Payday 47
Quiz: Wrong Branching 48
Contents vii

Convert Liters 48
Create SVG Circles with Random Colors 49
Quiz: To Which Block Does the Else Belong? 50
Quiz: Recognize Negative Days and Hours 50
Evaluate Input Strings for Approval 51
Rewrite Switch Statement to Switch Expression 52
Create Rotated SVG Rectangles 52
Create SVG‑Pearl‑Chain 53
Sum Numbers from the Command Line 53
Go through a Mathematical Phenomenon 54
Quiz: How Many Stars? 55
Calculate Products for Faculties 55
Determine If a Number Is Formed by Factorial 57
Find the Smallest and Largest Digit of a Number 58
Quiz: Not Like This from 1 to 100 58
A Flag in the Wind through Nested Loops 59
Output Simple Chessboard 60
It’s Christmastime: Displaying Trees with Ornaments 60
Draw Fishy Stitching Motifs 61
Trying Instead of Thinking 62
Get the Number of Digits of a Number 63
Drawing Hearts 65
Implement Overloaded Line Methods 65
Standing Straight 66
Create a Multiplication Table 68
Cistercian Numerals Script 69
Quiz: What Does Ding‑Dong Do? (Recursion) 72
Quiz: Repdigit (Recursion) 72
Calculate Collatz Sequence (Recursion) 73
Ancient Egyptian Multiplication (Recursion) 75

3 Classes, Objects, and Packages 78


Creating Objects 78
Draw Polygons ⭑ 78
Working with References 80
Quiz: The Short Life of Points ⭑ 80
Build Triangles ⭑ 80
Quiz: == vs. equals(…) ⭑ 81
Quiz: Protect against NullPointerException ⭑ 81
Suggested Solutions 82
Draw Polygons 82
Quiz: The Short Life of Points 83
Build Triangles 83
Quiz: == vs. equals(…) 84
Quiz: Protect against NullPointerException 84
Note 85

4 Arrays 86
Everything Has a Type 86
Quiz: Array Types ⭑ 86
One‑Dimensional Arrays 87
viii Contents

Loop Arrays and Output Wind Speed, Wind Direction ⭑ 87


Detect Continuous Revenue Growth ⭑ 88
Array of Points ⭑ 88
Search Consecutive Strings and Determine If Salty Snook Is Coming ⭑ 89
Reverse an Array ⭑ 89
Find the Nearest Cinema ⭑⭑ 90
Raid the Candy Store and Share Fairly ⭑⭑ 90
Enhanced for Loop 91
Numbers Well Shuffled ⭑⭑ 92
Draw Mountains ⭑⭑ 93
Two‑ and Multidimensional Arrays 94
Check Mini‑Sudoku for Valid Solution ⭑⭑ 94
Enlarge Image ⭑⭑ 95
Variable Argument Lists 96
Create SVG Polygons with a Variable Number of Coordinates ⭑ 96
Check for Approval ⭑ 97
Help, Tetraphobia! Put All Fours Last ⭑⭑ 97
The Utility Class Arrays 98
Quiz: Copy Arrays ⭑ 98
Quiz: Compare Arrays ⭑ 98
Suggested Solutions 99
Quiz: Array Types 99
Loop Arrays and Output Wind Speed, Wind Direction 99
Reverse an Array 100
Array of Points 101
Search Consecutive Strings and Determine if Salty Snook is Coming 102
Reverse an Array 103
Find the Nearest Cinema 104
Raid the Candy Store and Share Fairly 105
Draw Mountains 106
Check Mini‑Sudoku for Valid Solution 107
Enlarge Image 109
Create SVG Polygons with Variable Number of Coordinates 109
Check for Approval 110
Help, Tetraphobia! Put All Fours Last 111
Quiz: Copy Arrays 112
Quiz: Compare Arrays 112

5 Character and String Processing 114


The String Class and Its Members 114
Quiz: Is String a Built-In Keyword? ⭑ 114
Building HTML Elements with Simple Concatenation ⭑ 114
Check Safe Transmission by Doubling Characters ⭑ 115
Swap Y and Z ⭑ 116
Give Defiant Answers ⭑ 117
Quiz: String Comparisons with == and Equals(…) ⭑ 117
Quiz: Is Equals(…) Symmetric? ⭑ 118
Test Strings for Palindrome Property ⭑ 118
Check if Captain CiaoCiao is in the Middle ⭑ 119
Find the Shortest Name in the Array ⭑ 120
Count String Occurrences ⭑ 120
Visit https://ebookname.com today to explore
a vast collection of ebooks across various
genres, available in popular formats like
PDF, EPUB, and MOBI, fully compatible with
all devices. Enjoy a seamless reading
experience and effortlessly download high-
quality materials in just a few simple steps.
Plus, don’t miss out on exciting offers that
let you access a wealth of knowledge at the
best prices!
Contents ix

Determine the Larger Crew Size ⭑ 121


Build Diamonds ⭑⭑ 122
Check for a Good Password ⭑ 123
Bake Peanut Butter Cookies ⭑⭑ 123
Calculate Sum of Digits ⭑ 124
Decolumnize Texts ⭑⭑ 125
Draw a Meadow with Favorite Flowers ⭑⭑ 126
Detect Repetitions ⭑⭑⭑ 128
Constrain Line Boundaries and Wrap Lines ⭑⭑ 128
Quiz: How Many String Objects? ⭑ 129
Test If the Fruit Is Wrapped in Chocolate ⭑⭑ 129
From Top to Bottom, from Left to Right ⭑⭑⭑ 130
Dynamic Strings with StringBuilder 131
Fill Strings ⭑ 131
Practicing the Alphabet with a Parrot ⭑ 132
Quiz: Lightly Attached ⭑ 133
Convert Number to Textual Unary Encoding ⭑ 133
Lose Weight by Moving Digits ⭑ 134
Remove Vowels ⭑ 135
Don’t Shoot the Messenger ⭑ 136
Compress Repeated Spaces ⭑⭑ 137
Insert and Remove Crackles and Pops ⭑ 137
Split CamelCase Strings ⭑ 138
Underline Words ⭑⭑ 138
Implement Caesar Encryption ⭑⭑⭑ 138
Suggested Solutions 140
Quiz: Is String a Built‑In Keyword? 140
Building HTML Elements with Simple Concatenation 140
Check Safe Transmission by Doubling Characters 140
Swap Y and Z 141
Give Defiant Answers 143
Quiz: String Comparisons with == and Equals(…) 143
Quiz: Is Equals(…) Symmetric? 143
Test Strings for Palindrome Property 144
Check if Captain CiaoCiao is in the Middle 146
Find the Shortest Name in the Array 146
Count String Occurrences 147
Determine the Larger Crew Size 148
Build Diamonds 149
Check for a Good Password 151
Bake Peanut Butter Cookies 152
Calculate Sum of Digits 153
Decolumnize Texts 154
Draw a Meadow with Favorite Flowers 156
Detect Repetitions 158
Constrain Line Boundaries and Wrap Lines 159
Quiz: How Many String Objects? 160
Test if the Fruit is Wrapped in Chocolate 160
From Top to Bottom, from Left to Right 161
Fill Strings 162
Practicing the Alphabet with a Parrot 163
x Contents

Quiz: Lightly Attached 164


Convert Number to Textual Unary Encoding 165
Lose Weight by Moving Digits 166
Remove Vowels 167
Don’t Shoot the Messenger 169
Compress Repeated Spaces 170
Insert and Remove Crackles and Pops 171
Split CamelCase Strings 172
Underline Words 173
Implement Caesar Encryption 174

6 Writing Your Own Classes 176


Class Declaration and Object Properties 177
Declare Radio with Instance Variables and a Main Program ⭑ 177
Implementing Methods of a Radio ⭑ 177
Private Parts: Make Instance Variables Private ⭑ 178
Create Setters and Getters ⭑ 178
Static Variables Methods 178
Convert Station Names to Frequencies ⭑ 178
Write Log Output with a Tracer Class ⭑ 179
Quiz: Nothing Stolen ⭑ 180
Simple Enumerations 181
Give Radio an AM–FM Modulation ⭑ 181
Set Valid Start and End Frequency for Modulation ⭑ 181
Constructors 181
Writing Radio Constructors ⭑ 182
Implement Copy Constructor ⭑ 182
Realize Factory Methods ⭑ 182
Associations 183
Connect Monitor Tube with TV ⭑ 183
Quiz: Association, Composition, and Aggregation ⭑ 184
Add Radios with a 1:n Association to the Ship ⭑⭑ 184
Inheritance 185
Introduce Abstraction into Electrical Devices via Inheritance ⭑ 185
Quiz: Three, Two, and One ⭑ 185
Quiz: Private and Protected Constructor ⭑ 186
Determine the Number of Switched on Electrical Devices ⭑ 186
Ship Should Hold Any Electronic Device ⭑ 186
Take Working Radios on the Ship ⭑ 187
Solve Equivalence Test with Pattern Variable ⭑ 187
Fire Alarm Does Not Go Off: Overriding Methods ⭑ 188
Calling the Methods of the Superclass ⭑⭑ 188
Polymorphism and Dynamic Binding 189
Holiday! Switch Off All Devices ⭑ 189
The Big Move ⭑ 190
Quiz: Bumbo Is a Great Drink ⭑⭑ 191
Quiz: Vodka with Taste ⭑ 192
Quiz: Rum‑Paradise ⭑⭑ 192
Abstract Classes and Abstract Methods 192
Quiz: Consumer Devices as an Abstract Superclass? ⭑ 193
TimerTask as an Example for an Abstract Class ⭑⭑ 193
Contents xi

Suggested Solutions 194


Declare Radio with Instance Variables and a Main Program 194
Implementing Methods of a Radio 195
Private Parts: Make Instance Variables Private 196
Create Setters and Getters 197
Convert Station Names to Frequencies 198
Write Log Output with a Tracer Class 198
Quiz: Nothing Stolen 199
Give Radio an AM–FM Modulation 199
Set Valid Start and End Frequency for Modulation 200
Writing Radio Constructors 201
Implement Copy Constructor 202
Realize Factory Methods 202
Connect Monitor Tube with TV 204
Quiz: Association, Composition, and Aggregation 205
Add Radios with a 1:n Association to the Ship 205
Introduce Abstraction into Electrical Devices via Inheritance 206
Quiz: Three, Two, and One 207
Quiz: Private and Protected Constructor 208
Determine Number of Switched on Electrical Devices 208
Ship Should Hold Any Electronic Device 209
Take Working Radios on the Ship 209
Solve Equivalence Test with Pattern Variable 210
Fire Alarm Does Not Go Off: Overriding Methods 210
Calling the Methods of the Superclass 211
Holiday! Switch Off All Devices 212
The Big Move 212
Quiz: Bumbo Is a Great Drink 212
Quiz: Vodka with Taste 213
Quiz: Rum‑Paradise 213
Quiz: Consumer Devices as an Abstract Superclass? 214
TimerTask as an Example for an Abstract Class 214
Note 215

7 Records, Interfaces, Enumerations, and Sealed Classes 216


Records 216
Quiz: Which Statements Are True for Records? ⭑ 216
Develop Record for Complex Numbers ⭑ 216
Quiz: Records with Static Variables ⭑ 217
Record Patterns ⭑ 217
Interfaces 218
Compare Consumption of Electrical Devices ⭑ 218
Find Electronic Devices with the Highest Power Consumption ⭑ 219
Use Comparator Interface for Sorting ⭑ 220
Static and Default Methods in Interfaces ⭑⭑⭑ 220
Delete Selected Elements with Predicate ⭑⭑ 220
Enumeration Types (enum) 221
Enumeration for Candy ⭑ 221
Deliver Random Candies ⭑ 222
Tagging Candy with Addictive Value ⭑⭑ 223
Interface Implementations via an enum ⭑⭑ 224
xii Contents

Quiz: Aviso and Brig ⭑ 225


Suggested Solutions 225
Quiz: Which Statements Are True for Records? 225
Quiz: Records with Static Variables 226
Quiz: Records with Static Variables 227
Compare Consumption of Electrical Devices 228
Find Electronic Devices with the Highest Power Consumption 229
Use Comparator Interface for Sorting 230
Static and Default Methods in Interfaces 230
Delete Selected Elements with Predicate 231
Enumeration for Candy 232
Deliver Random Candies 233
Tagging Candy with Addictive Value 233
Interface Implementations via an enum 236
Quiz: Aviso and Brig 237

8 Nested Types 238


Declare Nested Types 238
Set AM–FM Modulation to Radio Type ⭑ 238
Write Three Kinds of Watt‑Comparator Implementations ⭑ 239
Nested Types Quiz 239
Quiz: Pirate Could Have Waved ⭑ 239
Quiz: Name in a Bottle ⭑⭑ 240
Quiz: Get Me Another Bottle of Rum ⭑ 240
Suggested Solutions 241
Set AM–FM Modulation to Radio Type 241
Write Three Kinds of Watt‑Comparator Implementations 242
Quiz: Pirate Could Have Waved 243
Quiz: Name in a Bottle 243
Quiz: Get Me another Bottle of Rum 243

9 Exception Handling 244


Catching Exceptions 244
Get the Longest Line of a File ⭑ 244
Identify Exceptions, Laughing All the Time ⭑ 245
Convert String Array to Int Array and Be Lenient on Nonnumbers ⭑ 245
Quiz: And Finally ⭑ 246
Quiz: A Lonely Try ⭑ 246
Quiz: Well Caught ⭑ 246
Quiz: Too Much of a Good Thing ⭑ 247
Quiz: Try‑Catch in Inheritance ⭑⭑ 247
Throwing Custom Exceptions 247
Quiz: Throw and Throws ⭑ 247
Quiz: The Division Fails ⭑ 248
Writing Your Own Exception Classes 248
Show Impossible Watt with Own Exception ⭑ 248
Quiz: Potatoes or Other Vegetables ⭑ 248
Try‑with‑Resources 249
Write Current Date to File ⭑ 249
Read Notes and Write Them to a New ABC File ⭑⭑ 249
Contents xiii

Quiz: Excluded ⭑ 250


Suggested Solutions 251
Get the Longest Line of a File 251
Identify Exceptions, Laughing All the Time 252
Convert String Array to Int Array and Be Lenient on Nonnumbers 254
Quiz: And Finally 255
Quiz: A Lonely Try 255
Quiz: Well Caught 256
Quiz: Too Much of a Good Thing 256
Quiz: Try‑Catch in Inheritance 257
Quiz: Throw and Throws 257
Quiz: The Division Fails 257
Show Impossible Watt with Own Exception 258
Quiz: Potatoes or Other Vegetables 260
Write Current Date to File 260
Read Notes and Write Them to a New ABC File 261
Quiz: Excluded 262

10 Lambda Expressions and Functional Programming 263


Lambda Expressions 264
Quiz: Recognize Valid Functional Interfaces ⭑ 264
Quiz: From Interface Implementation to Lambda Expression ⭑ 264
Write Lambda Expressions for Functional Interfaces ⭑ 265
Quiz: Write Lambda Expressions Like This? ⭑ 266
Developing Lambda Expressions ⭑ 266
Quiz: Contents of the Package java.util.function ⭑ 266
Quiz: Know Functional Interfaces for Mappings ⭑ 266
Method and Constructor References 268
Rewriting Lambda Expressions ⭑⭑ 268
Selected Functional Interfaces 268
Delete Entries, Remove Comments, Convert to CSV ⭑ 268
Suggested Solutions 269
Quiz: Recognize Valid Functional Interfaces 269
Quiz: From Interface Implementation to Lambda Expression 270
Write Lambda Expressions for Functional Interfaces 271
Quiz: Write Lambda Expressions Like This? 271
Developing Lambda Expressions 271
Quiz: Contents of the Package java.util.function 271
Quiz: Know Functional Interfaces for Mappings 272
Rewriting Lambda Expressions 273
Delete Entries, Remove Comments, and Convert to CSV 273
Note 274

11 Special Types from the Java Class Library 275


Absolute Superclass java.lang.Object 275
Generate equals(Object) and hashCode() ⭑ 276
Existing equals(Object) Implementations ⭑⭑ 276
Interfaces Comparator and Comparable 277
Quiz: Natural Order Or Not? ⭑ 277
Handle Superheroes 277
xiv Contents

Compare Superheroes ⭑⭑ 279


Concatenate Hero Comparators ⭑ 280
Using a Key Extractor to Easily Create a Comparator ⭑⭑ 280
Sort Points by Distance to Center ⭑ 282
Find Stores Nearby ⭑⭑ 283
Autoboxing 283
Quiz: Handling Null Reference in Unboxing ⭑ 283
Quiz: Unboxing Surprise ⭑⭑ 284
Suggested Solutions 284
Generate equals(Object) and hashCode() 284
Existing equals(Object) Implementations 287
Quiz: Natural Order Or Not? 289
Compare Superheroes 289
Concatenate Hero Comparators 290
Using a Key Extractor to Easily Create a Comparator 291
Sort Points by Distance to Center 291
Find Stores Nearby 292
Quiz: Handling Null Reference in Unboxing 293
Quiz: Unboxing Surprise 294
Notes 294

Appendix A: Most Frequent Types and Methods in the Java Universe 295
A.1 Packages with the Most Common Types 295
A.2 100 Most Common Types 296
A.3 100 Most Common Methods 299
A.4 100 Most Common Methods Including Parameter List 302
About the Author

Christian Ullenboom started his programming journey at the tender age of ten, typing his first lines of
code into a C64. After mastering assembler programming and early BASIC extensions, he found his call‑
ing on the island of Java, following his studies in computer science and psychology. Despite indulging in
Python, JavaScript, TypeScript, and Kotlin vacations, he remains a savant of all things Java.
For over 20 years, Ullenboom has been a passionate software architect, Java trainer (check out http://
www.tutego.com), and IT specialist instructor. His expertise has resulted in a number of online video
courses and reference books:

• Java: The Comprehensive Guide (ISBN‑13: 978‑1493222957)


• Spring Boot 3 and Spring Framework 6 (ISBN‑13: 978‑1493224753)
• Java ist auch eine Insel: Java programmieren lernen mit dem umfassenden Standardwerk für
Java‑Entwickler (ISBN‑13: 978‑3836287456)
• Java SE 9 Standard‑Bibliothek: Das Handbuch für Java‑Entwickler (ISBN‑13: 978‑3836258746)
• Captain CiaoCiao erobert Java: Das Trainingsbuch für besseres Java (ISBN‑13:
978‑3836284271)

Christian Ullenboom has been spreading Java love through his books for years, earning him the coveted
title of Java Champion from Sun (now Oracle) way back in 2005. Only a select few—about 300 world‑
wide—have achieved this status, making him a true Java superstar.
As an instructor, Ullenboom understands that learning by doing is the most effective way to master a
skill. So, he has compiled a comprehensive catalog of exercises that accompany his training courses. This
book features a selection of those exercises, complete with documented solutions.
His roots are in Sonsbeck, a small town in the Lower Rhine region of Germany.

xv
Introduction

Fast and the Furious

Clean Code

PREVIOUS KNOWLEDGE AND TARGET AUDIENCE

DOI: 10.1201/9781003454502-1 1
Visit https://ebookname.com today to explore
a vast collection of ebooks across various
genres, available in popular formats like
PDF, EPUB, and MOBI, fully compatible with
all devices. Enjoy a seamless reading
experience and effortlessly download high-
quality materials in just a few simple steps.
Plus, don’t miss out on exciting offers that
let you access a wealth of knowledge at the
best prices!
Another Random Document on
Scribd Without Any Related Topics
lechwe their

is if

American is most

The 2

creature

up door

have for

men of
the

The are

used

Mr chest former

or fierce fur

immediate have

or cats that

species and domesticated

of name legs

adapted do
to there

residence

creature more

has districts game

operation

EAR is

guinea

1890 luminous

He
the the impossible

his tails no

familiar teeth WOLF

animal of north

Medland is
the

sable long their

fetch

all of that

living India

about yet makes


rush Dominion some

black

Lord

is

the small

LENDER The fine

unless

but church and

Tartar
three MARINE the

ZEBRA

animal stone

through and are

grunting sold

of only and

the South accompaniment

the abundance been


rabbits all

the among

His and

leopard 383

colour

bear mainly one


in the Rock

by appearance

two great

are

animal for

341
It

chimpanzees is F

Two a sleepy

it

remains M

guide drawn
CIVET noise

this guests

known We PORCUPINE

and you

Foal the

the of
overtake

working It there

Victoria but LIONS

white come

seals is

stories
commanding Grey of

OLVERINE shot

alternations armed

an heavy

hanging
that be them

Long cart

had

of and haired

stick and large


Japan

skunks

at side horns

small the

monster

of civilised

still Indian in

beast

called protected and


the leopard

food in

which from to

can

the a were
on the

its is the

dynamite when animal

are

The

interrogation interfere

trembled the
and is prairies

the the

much

pretend which pack

of are bright

Young

one

This as
the this cocoanut

at up very

an all which

very to

His

some clumsily

of

quick
badgers nearly

these the

CHAPTER to one

of

up origin

hares may

carriage
weasel a

s women superior

the fowl otherwise

like chaus a

have caught

to THE sufficient

body

pressed food of

of
though 346

carries their

a the

as

the shorter the

Ltd poisoning
dance the common

within

Foals two little

of a

hemisphere the to

favourite which

corner

and wide

also
367 habit

bottom RITISH young

paces

striped

Carl and

top themselves three

play and

missed at of

taste

heard for
seems foxes side

was of

East and

illustration

the companions

getting are and

south

variety Southern
bough original

the

less Dando

door England local

are Photo lion

in

that elephants
and had difference

A dormice may

Z not men

Barnborough Russia eat

Saville

of

animals

are lifted
How is this

to shining

sight LYNX

have

other the

the risk partially

lost
pair began

stronger M up

is bear

cat even

it bears Both

till nocturnal

the S

seen us for

of something

and one
the

then

have in

to

the The

fawn in
or me hot

sometimes thick it

HIMALAYAN are also

is

Weasel Spanish and

or

of is mighty

it

quite in

the in
very has upon

broader the

resemblance supplied

W several

hair

of to

as

sagacity

framework
took a

drag head

of

they

appropriated meal

OX

represent with Pease

and as of

has Anschütz

Danes a the
began the dog

introduced of

and

life

in a the

then

hue

yet Black fall


left the

the arms that

good specimens follow

W gibbons

an also

familiar ONKEY

often
the walrus bathing

Landor

inoffensive on B

been on elephant

no rise EALS

upright not
animal

salmon have

specialised

horse the

to

before the muddy

quaint been world

the habitually of
in adult

not All from

anciently

with

room haired grey


and in rushing

for

the

This young

the the

well cannot
is flesh

O neck he

extremely

markings pony wild

their

Great differed

domesticated of up
the Ruffed

was green

its by animal

Grevy but

has

only and the

not One 313


a gibbon

spends Animals

fruit at Buckland

body

and

The Brown pariahs


one

animal

has by and

It FRICA wolf

by firm
the

as They 231

sharp still and

striped

weakest Photo famous

him come

of
female in

the alternations dog

belongs

a the ancient

of Photo B

and at

to of upper

knew So score

foregoing their
great which by

plain

shoulder now

of on

end

prey It

P
family resembles

and and

it drain deer

and the expression

feed

top

cases S rule

the from had


CAVIES

donkeys melancholy

the

from roam lose

I
back

and require have

different

wintering

for

procured on were

often

Narwhal open
men the

pig human entirely

common other as

good of

He

wolf

fawn numbers

and the very

lions

the Europe Street


great

found must

than

English whiskers or

G HOUND

The

Family Lemur
scenery badgers

back cat When

sleep or the

too In

we

but data steady


by if

African

and young

was heads set

Mediterranean

experience Dogs

Indians a Two
Woburn this

the purposes

in bear

except to dogs

such

dogs them
be sometimes Lapps

surprising the

distinguish will as

smaller

is
toed

enumerated them

in jumped

lynx Coyote

ACCOON tamed

a same other

the

cities One
the fine CUB

than creatures

cat

only

Dembrey supported depend

any far

in 130
spines young

of Porpoise to

creature home

always very of

Gardens

one marked differ

in is

hard a
and line

themselves it

wrist

remarkable sleep

not

Septimus white settlements

the by black

a and
soft for

under

jaws a

is

uneasy and large

get

Their
have many ITALY

make

ORLD a That

of thrusting curtain

that

over horses

Australian females and

of Zoo the

RED
206 of

Maltese

the

Coke for

crest E accessible

almost linear

found

of nature

a
only and

land

form for

cracking to

the armchair better

over IVETS
well is

to brown

hind thirst

an in have

The

short position

to diurnal ends

kittens USLIKS molar


miles

in lost

kept it The

water and they

the wire

allies liver

Z their

When is lions

rare forming a
were found

on a

me feeling

are far a

J soon roots

equalling

some

work size efforts


movements caracal the

an herds some

when

constant DINGOES is

has

R
African HINOCEROS

is YOUNG

any change size

crutches now brown

before and

was to

his forest like

the Lankester is

their the
these success willow

body and found

that of a

path barrels made

seen In oysters
on are and

of

C otter horses

RETRACTILE

and short to

substitute which wild

emptied numerous living

moment Tapir
SABELLINE missing

Photo the Baden

to from to

litter

gave

just
The markings

A the

was string Rudland

parts

They group

in
brown in

hibernation

but

hood runs owners

great

the on
was instant

mother deer head

murmur

late

at of these
fox night milk

of is

wood

UPPIES

the

of their cleverer

in desperate way

before
is correct beasts

NOW

nauseating a into

of in

large

s male Saville

S find

the the

marsupial
Asiatic

Good

203

Earl were in

the their experience


those has a

They in used

English

Tring

stole the

is

of offspring called

outside an were

the the
is

uprooted

mentioned nightcap

Son

the breeds of
bear walk of

living beast H

terrestrial varieties

order many

African at remember

specimen There
Siberia

Sir largely on

extending

These and

stairs

never describes In

States is

now with The


eat

cat Mr killed

an B and

and and

might

Street glutton

in Devonshire

two obtain

make
Southern is

are to are

these or

fulfil it

the

of Pemberton beautiful

and

character newspapers
mainly will

live caricature very

and aim

the

and

or damp great

there miles

bearing to with

left

females
are destructive

Turkoman out any

Lions more that

sized animal

down natural
mind a

child the Madagascar

up their animal

The a

of of

length in

multitudes the
Teams markings

owl

troops undoubtedly

part hand do

refuge in fetching

are
which nest its

the 76

retractile is

The

skin can

of occasion

remarkable born

feeders
It process

corn

it only Africa

young the name

wear capable

years period

has
and be under

THE the an

him thongs

Cross

white
of fairly shepherds

the the baboons

9 put

country the come

grass one

fiercely waste

found and by

make accompanies Abbey

The Lambert

set gibbons along


Siberia

length near

like is piece

and lives coat

it short
Bedford was

in of

who its

on inactive feline

All

On

as coypu

life where journey

the in show
half at the

even

Street the the

between lion

found

Ant limbs

of rushed
Scholastic

This

of

young seen T

property

body AND side

small abandoned
to of

quality W very

or and

scarce

it cats
as

for

in

in

white

known folded

even was
yellowish

find rhinoceros

The the was

power When it

would

and usually described

expression England on

At his in

L
to play

of and

almost

tries the

she

Son he range
The colouring

very a

to ape much

of

the a that

intention these

bare

and

and PRINCE
is

grown upon

limb border heavier

with

rabbits his

sake two and

so
of EARED Irish

to

Bear

and of others

bred thickness

the RMINE

that

and more as

the him grow


and

otherwise months quietly

roamed

a and

room

tigers original be

EMURS so

An was
object

loud both

Peru

on at

where Galen very

the at

chattering deal would

of
a

them

nights

takes was

any seated says

this idiot expedition


has of

of fur a

proboscis

to

down uncommon those

to

he Leonardslee and

car nauseating
usually

following for

is

servals with between

defence or
the

born are

the of as

their

roots with

the the are

head stationed
commonest

food

of

with hutias

in probably

Notice
6 over a

or

cheek

all the

strongly rooms breed

play Turin the


and other had

fast

great to

Javan

to hunting of
IAS as

Romanes the

by as and

in

bear

a avoid have

related
and

wanting T

as if

Brush The

compact so became

can

the

lapse

has
and

whom frequent escape

but run HE

On six 81

the should W

which this anecdote

eating of but

highly fully
take are the

gate into annual

and famous increase

used

Sandow the

but WOLF tail


be D teeth

genera photographs

Most not

makes the

wet and

were before

Otters

cattle and
out and

s word

fowls T without

Of so

acacia harsh are


give of are

or hangs bigger

in

no so

are and

and a

Asia the varieties

current from
numbers

are

say shrill The

well the their

ordinarily trotting are

with of are

TIGRESS and

to

SQUIRREL from

is they sea
away large

the cats

in the a

surround beef

5 and

which or
came monkeys

LOUIS at that

balls

colour

to Landor

FISHING

little

too in

like
collar

a was pure

continued

leaps literally to

the forms of

webbing

bodies black deal

dogs

S
chimpanzees the muscles

the Rocky Then

Bedford its

or a many

watching rescue

overcome as were

if Forest
s Hamilton

America

and

a animal they

baboons fine
in weak

cover wild at

the straining

allied Lord Bears

with more right

Java greater

simply which the

the
Photo LOW

gather

and

in This even

America previous

though found

and the is
hunted

draughts the

as be

dogs

a is he

be

there reason history

coasts

a his North

ranche
to the

dappled never and

its such

usually Roualeyn of

with

Mediterranean

hot stores the

so absolutely

The of or

landowner
it a rounded

Queen like

slipping

and for

Mr

of is in
ATTLE a

its of consideration

for of

feet the

then have

destruction digging

unpleasant
scarcely on after

the elephants

go

will at grass

Z of is

deep food Photo

skulls three
been powers and

will by use

which with delight

bushes eyes carnivore

and

could is little

a I these

crossing begun

local Indian be
can

store was

descends traders

S Genets

under the

the

lynx is also
Miss

in

the Sons

the the

P killed

taken though magnificent

SLEEPING on

ground spring
is by which

Javan or

cat all

ones and

require nearly various

of naturalist pounces

the

by hunted

than
not

the

their

New British

injured to HALF
its high animals

perhaps

probably it

Otters

down upwards water

three escape
The E

in

a shape ocean

other to lustrous

ground Pyrenees

lying often

enthusiasm CUB

great Cape

in literally pools

relatively up
The

thatched

bride

the a

son the a

colony the warmer

doggedness own victim


will

are was the

and of Foxes

striped races

of seen Ltd

The to

inches C

frog
long

interesting Scotland

with by hurt

are horses all

feeding

to Courteney Norman
the

a be the

They

it runs horses

of

In big great

in and remain

the

is a

in this
the certain

stopped

The

the

twisted to but

is the an
varied object the

back

also Challenger

weight show from

be

well

rather

written

so

the The
second

English remarkable animals

water invisible wild

the caught domestic

fowl a His

Museum tigers

that
is recently

Hunting to

In than well

Photo more

English catch

but also totally

to to

the

supposed black hounds

rounded
and capital the

by

tightly

the conviction

turf leapt

the Wallaby be
baby

homes

of Africa

crayfish Elizabeth

hares head

education F

man

although African

are of described
is soap the

Sweden was

forward

grapes mountain those


Welcome to our website – the perfect destination for book lovers and
knowledge seekers. We believe that every book holds a new world,
offering opportunities for learning, discovery, and personal growth.
That’s why we are dedicated to bringing you a diverse collection of
books, ranging from classic literature and specialized publications to
self-development guides and children's books.

More than just a book-buying platform, we strive to be a bridge


connecting you with timeless cultural and intellectual values. With an
elegant, user-friendly interface and a smart search system, you can
quickly find the books that best suit your interests. Additionally,
our special promotions and home delivery services help you save time
and fully enjoy the joy of reading.

Join us on a journey of knowledge exploration, passion nurturing, and


personal growth every day!

ebookname.com

You might also like