Add syntax highlighting

This commit is contained in:
Ilkka Seppälä 2020-08-09 21:54:54 +03:00
parent 8305e9365d
commit 7450456dae

View File

@ -35,7 +35,7 @@ Wikipedia says
Taking our stew example from above. First we have a `Stew` class where its data is not protected by Taking our stew example from above. First we have a `Stew` class where its data is not protected by
private class data, making the stew's ingredient mutable to class methods. private class data, making the stew's ingredient mutable to class methods.
``` ```java
public class Stew { public class Stew {
private static final Logger LOGGER = LoggerFactory.getLogger(Stew.class); private static final Logger LOGGER = LoggerFactory.getLogger(Stew.class);
private int numPotatoes; private int numPotatoes;
@ -73,7 +73,7 @@ public class Stew {
Now, we have `ImmutableStew` class, where its data is protected by `StewData` class. Now, the Now, we have `ImmutableStew` class, where its data is protected by `StewData` class. Now, the
methods in are unable to manipulate the data of the `ImmutableStew` class. methods in are unable to manipulate the data of the `ImmutableStew` class.
``` ```java
public class StewData { public class StewData {
private final int numPotatoes; private final int numPotatoes;
private final int numCarrots; private final int numCarrots;
@ -114,7 +114,7 @@ public class ImmutableStew {
Let's try creating an instance of each class and call their methods: Let's try creating an instance of each class and call their methods:
``` ```java
var stew = new Stew(1, 2, 3, 4); var stew = new Stew(1, 2, 3, 4);
stew.mix(); // Mixing the stew we find: 1 potatoes, 2 carrots, 3 meat and 4 peppers stew.mix(); // Mixing the stew we find: 1 potatoes, 2 carrots, 3 meat and 4 peppers
stew.taste(); // Tasting the stew stew.taste(); // Tasting the stew