Skip to content

Commit 98f8654

Browse files
authored
Give complete-ish explanation of floating point (#13)
* Give complete-ish explanation of floating point ... ... * Fix extension on escaped_characters.md * More floating point + digging into char * Get challenges for characters * Productive Start on Strings * Fix mistake in integer challenge * Update scratch.md * Update first_steps.md * Fix links * misc. fixes * Fix Lints on types.md * Fix lints on reassignment.md * Fix lints on naming.md and inferred_types.md * Fix lints on final_variables.md * Fix lints on challenges.md * Fix lints on variables mds * Update .markdownlint.yaml * Fix some more lints * Fix .s on challenges * Autofix some errors * Update .markdownlint.yaml * Update .markdownlint.yaml * Fix lints * Gen files * Fix spelling * Fix links * ...
1 parent 9595d50 commit 98f8654

File tree

105 files changed

+1245
-243
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

105 files changed

+1245
-243
lines changed

.markdownlint.yaml

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
# See the example config: https://github.com/DavidAnson/markdownlint/blob/main/schema/.markdownlint.yaml
22
# MD013/line-length - Line length
3+
MD007:
4+
indent: 4
35
MD013:
4-
line_length: 100
6+
line_length: 300
7+
MD033:
8+
allowed_elements: ["iframe", "sup"]

CONTRIBUTING.md

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1-
# Welcome to the Modern Java project!
1+
# Welcome to the Modern Java project
22

33
First off, thank you for considering contributing to Modern Java. :tada:
44

55
Modern Java is an open source project, and we love to receive contributions from our community — **you**!
66

77
## How to contribute
88

9-
Please head over to the [Wiki](https://github.com/Together-Java/ModernJava/wiki) and in particular check out the article [Contributing](https://github.com/Together-Java/ModernJava/wiki/Contributing) to learn more about this project and how you can make it a better place.
9+
Please head over to the [Wiki](https://github.com/Together-Java/ModernJava/wiki) and
10+
in particular check out the article
11+
[Contributing](https://github.com/Together-Java/ModernJava/wiki/Contributing) to
12+
learn more about this project and how you can make it a better place.

README.md

+9-5
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,15 @@
66

77
Book teaching how to write modern and effective Java. It is maintained by the community, anyone can contribute.
88

9-
Feel free to join our [discord server](https://discord.com/invite/XXFUXzK) if you have any questions, or require assistance with the project. :relaxed:
9+
Feel free to join our [discord server](https://discord.com/invite/XXFUXzK)
10+
if you have any questions, or require assistance with the project. :relaxed:
1011

11-
# Getting started
12+
## Getting started
1213

13-
Please read [Contributing](https://github.com/Together-Java/ModernJava/wiki/Contributing) guidelines if you are considering helping us out!
14-
There you will find a detailed guide on how to contribute, and plenty of resources in case this is your first time submitting a PR to an open-source project.
14+
Please read [Contributing](https://github.com/Together-Java/ModernJava/wiki/Contributing)
15+
guidelines if you are considering helping us out! There you will find a detailed
16+
guide on how to contribute, and plenty of resources in case this is your
17+
first time submitting a PR to an open-source project.
1518

16-
Head over to the [Wiki](https://github.com/Together-Java/ModernJava/wiki) as general entry point to the project. It provides lots of tutorials, documentation and other information.
19+
Head over to the [Wiki](https://github.com/Together-Java/ModernJava/wiki) as general
20+
entry point to the project. It provides lots of tutorials, documentation and other information.

src/SUMMARY.md

+159-40
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,13 @@
1414
- [tutorialspoint paid course](./examples/tutorialspoint_paid.md)
1515
- [w3schools](./examples/w3schools.md) -->
1616
# Getting Started
17+
1718
- [Hello, World](./getting_started/hello_world.md)
19+
1820
# Modern Java
21+
1922
- [Prelude](./prelude.md)
23+
- [Toy Problems](./prelude/toy_problems.md)
2024
- [First Steps](./first_steps.md)
2125
- [Comments](./first_steps/comments.md)
2226
- [Semicolons](./first_steps/semicolon.md)
@@ -30,13 +34,17 @@
3034
- [Final Variables](./variables/final_variables.md)
3135
- [Inferred Types](./variables/inferred_types.md)
3236
- [Challenges](./variables/challenges.md)
37+
38+
# Basic Data Types
39+
3340
- [Booleans](./boolean.md)
3441
- [And](./boolean/and.md)
3542
- [Or](./boolean/or.md)
3643
- [Not](./boolean/not.md)
37-
- [Operator Precedance](./boolean/operator_precedance.md)
38-
- [Challenges](./challenges.md)
44+
- [Operator Precedence](./boolean/operator_precedence.md)
45+
- [Challenges](./boolean/challenges.md)
3946
- [Integers](./integers.md)
47+
- [Integer Literals](./integers/integer_literals.md)
4048
- [Addition](./integers/addition.md)
4149
- [Subtraction](./integers/subtraction.md)
4250
- [Multiplication](./integers/multiplication.md)
@@ -45,56 +53,88 @@
4553
- [Equality](./integers/equality.md)
4654
- [Comparison](./integers/comparison.md)
4755
- [Chained Comparisons](./integers/chained_comparisons.md)
48-
- [Operator Precedance](./integers/operator_precedance.md)
56+
- [Operator Precedence](./integers/operator_precedence.md)
4957
- [Reassignment](./integers/reassignment.md)
5058
- [Shorthands for Reassignment](./integers/shorthands_for_reassignment.md)
5159
- [Limits](./integers/limits.md)
5260
- [Challenges](./integers/challenges.md)
5361
- [Floating Point Numbers](./floating_point_numbers.md)
54-
- [Limits](./floating_point_numbers/limits.md)
55-
- [float and double](./numbers/float_and_double.md)
56-
- [Precision]()
57-
- [The "epsilon" Pattern]()
58-
59-
62+
- [Floating Point Literals](./floating_point_numbers/floating_point_literals.md)
63+
- [Accuracy](./floating_point_numbers/accuracy.md)
64+
- [Addition](./floating_point_numbers/addition.md)
65+
- [Subtraction](./floating_point_numbers/subtraction.md)
66+
- [Multiplication](./floating_point_numbers/multiplication.md)
67+
- [Division](./floating_point_numbers/division.md)
68+
- [Equality](./floating_point_numbers/equality.md)
69+
- [Comparison](./floating_point_numbers/comparison.md)
70+
- [Shorthands for Reassignment](./floating_point_numbers/shorthands_for_reassignment.md)
71+
- [NaN](./floating_point_numbers/nan.md)
72+
- [Positive and Negative Infinity](./floating_point_numbers/positive_and_negative_infinity.md)
73+
- [Square Root](./floating_point_numbers/square_root.md)
74+
- [Conversion to Integers](./floating_point_numbers/conversion_to_integers.md)
75+
- [Conversion from Integers](./floating_point_numbers/conversion_from_integers.md)
76+
- [Challenges](./floating_point_numbers/challenges.md)
77+
- [Characters](./characters.md)
78+
- [Character Literals](./characters/character_literals.md)
79+
- [Common Escape Sequences](./characters/common_escape_sequences.md)
80+
- [Conversion to Integers](./characters/conversion_to_integers.md)
81+
- [Conversion from Integers](./characters/conversion_from_integers.md)
82+
- [Unicode](./characters/unicode.md)
83+
- [Challenges](./characters/challenges.md)
6084
- [Strings](./strings.md)
61-
- [String Theory](./strings/string_theory.md)
62-
- [Escaped Characters](./strings/escaped_characters.md)
63-
- [Multiline Strings](./strings/multiline.md)
64-
65-
- [If and Else]()
66-
- [If Statement]()
67-
- [Relation to Delayed Assignment]()
68-
- [Integer Comparisons]()
69-
- [Floating Point Number Comparisons]()
70-
- [String Comparisons]()
71-
- [Ternary Expression]()
72-
73-
- [While Loop]()
74-
- [Arrays]()
75-
- ["String\[\] args"]()
76-
- [For Each Loop]()
77-
- [Counted For Loop]()
78-
- [Methods]()
79-
- [Arguments]()
80-
- [Return Value]()
81-
- [void]()
82-
- [String Methods]()
83-
- [length]()
84-
- [User Defined Classes]()
85-
- [Fields]()
86-
- [Constructors]()
87-
- [Methods]()
85+
- [String Literals](./strings/string_literals.md)
86+
- [Common Escape Sequences](./strings/common_escape_sequences.md)
87+
- [The Empty String](./strings/empty_string.md)
88+
- [Multiline String Literals](./strings/multiline.md)
89+
- [Concatenation](./strings/concatenation.md)
90+
- [Equality](./strings/equality.md)
91+
- [Challenges](./strings/challenges.md)
92+
93+
# Control Flow I
94+
95+
- [Branching Logic](./branching_logic.md)
96+
- [If](./branching_logic/if.md)
97+
- [Else](./branching_logic/else.md)
98+
- [Else If](./branching_logic/else_if.md)
99+
- [Relation to Delayed Assignment](./branching_logic/relation_to_delayed_assignment.md)
100+
- [Ternary Expression](./branching_logic/ternary_expression.md)
101+
- [Loops](./loops.md)
102+
- [While](./loops/while.md)
103+
- [Termination Conditions](./loops/termination_conditions.md)
104+
- [Break](./loops/break.md)
105+
- [Continue](./loops/continue.md)
106+
- [Do](./loops/do.md)
88107

89-
90-
- [Control Flow]()
108+
# User Defined Types
109+
110+
- [Classes](./classes.md)
111+
- [Primitive Classes](./classes/primitive_classes.md)
112+
- [Reference Classes](./classes/reference_classes.md)
113+
- [null](./classes/null.md)
114+
- [Class Declaration](./classes/class_declaration.md)
115+
- [Naming](./classes/naming.md)
116+
- [Fields](./fields.md)
117+
- [Default Values](./fields/default_values.md)
118+
- [Methods](./methods.md)
119+
- [Arguments](./methods/arguments.md)
120+
- [Return Values](./methods/return_values.md)
121+
- [void](./methods/void.md)
122+
- [Constructors](./constructors.md)
91123

92124
<!--
125+
Arrays
126+
Generics
127+
Maven
128+
XML
129+
Pom
93130
byte, short, long
94131
Multiversal Equality
132+
Reflection
133+
Cover Invoking *public* constructs
134+
Annotations
135+
Javadoc and Documentation comments
95136
-->
96137

97-
98138
<!--
99139
# Legacy Java
100140
- [Legacy Java]()
@@ -129,7 +169,7 @@ Multiversal Equality
129169
- [Inner Classes]()
130170
- [Annotations]()
131171
- [Reflection]()
132-
-->
172+
-->
133173

134174
<!--
135175
- Introduction
@@ -161,4 +201,83 @@ Multiversal Equality
161201
162202
- Packages and Imports
163203
- Top Level Definitions in Packages
204+
205+
- Virtual Threads
206+
- Foreign Memory API
207+
- jextract
208+
- Cleaner api
209+
210+
- StructuredTaskScope
211+
- Executors
212+
213+
- [Build Tool]
214+
- [Maven]
215+
- Dependencies
216+
217+
```xml
218+
<?xml version="1.0" encoding="UTF-8"?>
219+
<project xmlns="http://maven.apache.org/POM/4.0.0"
220+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
221+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
222+
<modelVersion>4.0.0</modelVersion>
223+
224+
<groupId>org.example</groupId>
225+
<artifactId>project</artifactId>
226+
<version>1.0-SNAPSHOT</version>
227+
228+
<properties>
229+
<maven.compiler.source>19</maven.compiler.source>
230+
<maven.compiler.target>19</maven.compiler.target>
231+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
232+
</properties>
233+
234+
</project>
235+
```
236+
237+
- Getting Started
238+
- [Hello, World]()
239+
- Data Types
240+
- int and long
241+
- Integer Division
242+
- float and double
243+
- Floating Point Numbers
244+
- booleans
245+
- Arrays
246+
- String
247+
- String Literals
248+
- Multiline String Literals
249+
- Expressions
250+
- Conditionals
251+
- Loops
252+
- Exceptions
253+
- Checked Exceptions
254+
- Unchecked Exceptions
255+
- Interfaces
256+
- Sealed Interfaces
257+
- Visibility Modifiers
258+
- Types of Objects
259+
- Records
260+
- Enums
261+
- Inheritance
262+
- Abstract Classes
263+
- Final Classes
264+
- Sealed Classes
265+
- Inversion of Control
266+
- JDBC
267+
- ResultSet
268+
- SQLException
269+
- Service Provider
270+
- jcmd
271+
- jfr
272+
- Custom JFR Events
273+
- Logging
274+
- XML
275+
- UncheckedIOException
276+
- Pattern Matching
277+
- instanceof
278+
279+
- Maven before hikaricp
280+
- HikariCP for connection pool
281+
282+
System.console() over Scanner?
164283
-->

src/basic_loops.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Basic Loops

src/boolean.md

-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
# Booleans
22

3-
43
A `boolean` is either `true` or `false`.
54

6-
75
```java
86
boolean onFleek = true;
97
boolean badVibes = false;
108
```
119

1210
This is used to represent situations where there are exactly two possible states.
13-

src/boolean/and.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ they wholeheartedly believe in the assertions made in the [Universal Declaration
1616
| true | true | true |
1717
| true | false | false |
1818
| false | true | false |
19-
| false | false | false |
19+
| false | false | false |

src/boolean/challenges.md

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
# Challenges
22

33
Remember the rules for this are
4+
45
* Try to use only the information given up to this point in this book.
56
* Try not to give up until you've given it a solid attempt
67

7-
## Challenge 1.
8+
## Challenge 1
89

910
What will this program output when run? Write down your guess and then try running it.
1011

@@ -23,7 +24,7 @@ public class Main {
2324
}
2425
```
2526

26-
## Challenge 2.
27+
## Challenge 2
2728

2829
What will this program output when run? Write down your guess and then try running it.
2930

@@ -42,7 +43,7 @@ public class Main {
4243
}
4344
```
4445

45-
## Challenge 3.
46+
## Challenge 3
4647

4748
Say you have two boolean variables, how could you use the operators we've covered to get the "exclusive or" of the two.
4849

@@ -67,4 +68,4 @@ Make sure to test all the possibilities.
6768
| true | true | false |
6869
| true | false | true |
6970
| false | true | true |
70-
| false | false | false |
71+
| false | false | false |

src/boolean/not.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Not
22

3-
Booleans can alsobe "negated" using the "not" operator - `!`.
3+
Booleans can also be "negated" using the "not" operator - `!`.
44

55
```java
66
boolean haveOreosInHouse = true;
@@ -12,4 +12,4 @@ So in this case, I have stuck to my calorie limit if there are _not_ Oreos in th
1212
| haveOreosInHouse | stuckToCalorieLimit |
1313
|------------------|---------------------|
1414
| false | true |
15-
| true | false |
15+
| true | false |

src/boolean/operator_precedance.md src/boolean/operator_precedence.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Operator Precedance
1+
# Operator Precedence
22

3-
The operators that work on booleans have a "precedance order."
3+
The operators that work on booleans have a "precedence order."
44

55
This is defines an order of operations similar to mathematics, where multiplication and division happen before
66
addition and subtraction.
@@ -22,7 +22,7 @@ boolean result = a && !b || c;
2222
Also like mathematics, parentheses can be used to control this order.
2323

2424
```java
25-
// Even though || has a lower precedance than &&, we evaluate
25+
// Even though || has a lower precedence than &&, we evaluate
2626
// !b || c first because of the parentheses.
2727
boolean result = a && (!b || c);
28-
```
28+
```

0 commit comments

Comments
 (0)