## List of Exercises

Table 2. Exercises in Software development 1
Chapter Exercise
No. Title Status of completion
Getting started 1 Extending class HelloWorld
2 Renaming a class file
3 Editing and compilation
4 Editing bytecode
5 Working with variables
6 Code equivalence
7 Different byte code, same execution results
8 A conditional
9 A loop
10 Details on execution
Language Fundamentals 11 Hotel key cards
12 Legal variable names
13 Benefits of final
14 «C» vs. Java.
15 Assignment and type safety
16 Inventing tinyint.
17 An int's minimum and maximum value
18 Pretty may not be pretty
19 Strange output
20 Representing emoticons.
21 Poor mans ASCII table
22 Integer value hexadecimal representation
23 Binary literals
24 Testing the limits (Difficult)
25 Why using braces in System.out.println(...) ?
26 Composing strings of literals and variables
27 Escaping double quotes
28 Supplementary string exercises
29 Unicode and emoticons
30 int and char
31 float vs. double
32 int to char narrowing problems
33 Get a byte from 139
34 Ariane, I miss you!
35 Reducing long to int (difficult)
36 Calculating a circle's area
37 Dividing values
38 Strange things happen
40 Representational float and double miracles
41 Expressions involving infinity
42 int to short assignment
43 int to short assignment using final
44 Calculating a circle's area avoiding accidental redefinition
45 Turning weeks into seconds
46 Turning seconds into weeks
47 Using predefined Java™ standard library constants
48 Converting temperature values
49 Time unit conversion
50 Interest calculation
51 Summing short and char
52 Operator & vs. &&
53 Understanding +=
54 Three ways expressing the same
55 Guessing results
56 Cleaning up the mess
Statements 57 Providing better display
58 Comparing for equality
59 Replacing else if (...){...} by nested if ... else statements
60 Post modifying an exam's marking
61 At the bar
62 Roman numerals
63 Why break?
64 Extending to month days
65 Converting day's names to numbers.
66 Day categories.
67 Roman numerals, using switch
68 Leap years
69 Even or odd?
70 Printing even numbers
71 Merry Xmas
72 More fun with Xmas trees
73 A basic square number table
74 Tidy up the mess!
75 HTML-ify me
76 Auxiliary Example, part 1: A multiplication table
77 Auxiliary Example, part 2: Avoiding redundant entries
78 Creating a real square table
79 Creating a sophisticated HTML version of your square table
80 Display all summands
81 Playing lottery
82 Guessing numbers
83 Smallest multiple
84 Smallest multiple, purely algebraic solution
85 Pythagorean triples
Objects and Classes 86 Compile time error
87 Static code analysis
88 Understanding access control
89 Explaining times
90 Method signature variants
91 Will a match be found?
92 Modeling geometry objects: Rectangles
93 Modeling circles
94 Adding translations and SVG export.
95 Extending the employee example.
96 Refining access to an employee's attributes
97 File system representation
98 Constructors variable names and this.
99 Your personal String class
100 Turning seconds into weeks, part 2
101 Class vs. instance
102 Distinguishing leap- and non-leap years
103 A method for printing square numbers using for, while and do ... while
104 Nicely formatting sine values.
105 Extending our interest calculator
106 Integer value considerations.
107 A class representing fractions
108 Programmer's favourite expression
109 Lotteries revisited
110 Finding the greatest common divisor of two integer values
111 Cancelling fractions
112 Dealing with local Maven dependencies
113 Maximum and absolute value
114 Factorial, the direct way
115 Factorial, the recursive way
116 Binomials, the recursive way
117 The exponential $f ⁡ x = e x$
118 Implementing $sin ⁡ ( x )$.
119 Summing up in a different order.
120 Transforming arguments.
121 Summing up integers to a given limit
122 Summing up, the better way
123 Compass directions
124 Compass direction neighbours
125 git local, DIY
126 git distributed, DIY
Core Classes 127 Choosing a good hashCode() method
128 String and good hashCode() implementations.
129 Reconsidering System.out.format().
130 Using constants from java.lang.Math.
131 String exercises
133 UTF-8 and emoticons
134 Analyzing strings
135 Pitfalls using ==: Equality of String instances
136 Weird, weirder, weirdest!
137 Analyzing file pathnames
Arrays 138 Assignment to final variable?
139 Converting string arrays to HTML.
141 Examinations and mark frequencies
142 Understanding search results
143 Implementing append directly
144 Purge duplicates
145 A container of fixed capacity holding integer values
146 Allow for variable capacity holding integer values
147 Reading console input
148 Prettifying output representation
149 2-dimensional arrays and .length
150 External array and string exercises
151 Tic-tac-toe using a two-dimensional array
152 Changing the game's internal representation
153 Tic-tac-toe, Computer vs. human
154 Adding support to retrieve statistical data.
155 Testing an implementation
156 Improving prime number calculation performance
157 Calculating the median
158 A simple character based plotting application
Inheritance 159 Let me in, please!
160 Why does == work for enum instances?
161 String vs. StringBuffer
162 Alternate implementation of opposite directions
163 Defining a Shape class hierarchy
164 Scaling shapes
165 Providing toString() methods
166 protected vs. package private
167 protected access involving different instances
168 Why is oRectangle = (Rectangle) o a legal cast?
Error Handling 169 Mind your prey
170 Expected exception test failure
Working with Numbers 171 Auto boxing int to Double?
172 Why using String userInput = "dummyValue"?
173 Parsing short values
174 Parsing short values in hexadecimal representation
175 Locale definitions
176 Formatting int, double and LocaleDate
interface definitions and abstract Classes 177 Understanding Arrays.sort()
178 Sorting Rectangle instances by width
179 Sorting Rectangle instances by width and height
180 Adding flexibility in sorting rectangles
181 A nonsense generator
182 An interface based plotter
Application deployment I 183 Various integer array algorithms
184 A command line version computing a sample's average and median
Reading character streams 185 Adding line numbers to text files
186 A partial implementation of GNU UNIX wc
Collections 187 Inserting strings into a Set.
188 Inserting strings into a List.
189 Representing integer coordinate values
190 Inserting Coordinate instances into a Set.
191 Getting a text's set of words.
192 A text's set of words in alphabetic order
193 Implementing unusual string sorting.
194 Words and corresponding frequencies
195 Formatting an address list
196 Implementing a set of strings
197 Implementing word frequencies by Map<String, Integer> instances.
198 Regain sorting capabilities.
199 Creating an overview of grades showing frequencies
200 Creating an overview of grades showing individual names