From 5f52d0a80846d82e1ed48ad301af5f8e3d4ba8f6 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Sun, 20 Oct 2019 15:58:40 +0200 Subject: [PATCH] fixed the first footnote in java_5 --- blog/java_5.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/blog/java_5.md b/blog/java_5.md index a0c292b..6802e53 100644 --- a/blog/java_5.md +++ b/blog/java_5.md @@ -86,7 +86,7 @@ public class Main { } } ``` -As you can see, the program now prints out 11 instead of 10. That's because of something Java uses called *pointers*[^1]: Our `thing` variable in the `main` method doesn't really store the actual *instance*, but instead, it stores the location of that instance in memory. So when passing that variable into the `addOne` method, all we pass is the information "The thing we're trying to modify sits in this part of memory, so modify the data there, please." That's why, when we then change the `Thing`'s `i` variable, it's also modified outside of the method. +As you can see, the program now prints out 11 instead of 10. That's because of something Java uses called *pointers*[^1]. Our `thing` variable in the `main` method doesn't really store the actual *instance*, but instead, it stores the location of that instance in memory. So when passing that variable into the `addOne` method, all we pass is the information "The thing we're trying to modify sits in this part of memory, so modify the data there, please." That's why, when we then change the `Thing`'s `i` variable, it's also modified outside of the method. # `null` Any variables that can store objects rather than primitive types (our `thing` variable from before, for example) can have a state where they don't point to an object, but instead, point to nothing. This "nothing" is called `null`.