summaryrefslogtreecommitdiff
path: root/content/digarden/pages/20221028223544-nullpointerexception.org
diff options
context:
space:
mode:
Diffstat (limited to 'content/digarden/pages/20221028223544-nullpointerexception.org')
-rw-r--r--content/digarden/pages/20221028223544-nullpointerexception.org30
1 files changed, 30 insertions, 0 deletions
diff --git a/content/digarden/pages/20221028223544-nullpointerexception.org b/content/digarden/pages/20221028223544-nullpointerexception.org
new file mode 100644
index 0000000..24d966e
--- /dev/null
+++ b/content/digarden/pages/20221028223544-nullpointerexception.org
@@ -0,0 +1,30 @@
+:PROPERTIES:
+:ID: f346dcfa-5575-4aab-a245-36ff96266611
+:END:
+#+title: NullPointerException
+* NullPointerException
+Thrown when an application attempts to use null in a case where an
+object is required. These include:
+
+- Calling the instance method of a null object.
+- Accessing or modifying the field of a null object.
+- Taking the length of null as if it were an array.
+- Accessing or modifying the slots of null as if it were an array.
+- Throwing null as if it were a Throwable value.
+
+https://stackoverflow.com/questions/218384/what-is-a-nullpointerexception-and-how-do-i-fix-it
+
+NullPointerExceptions are exceptions that occur when you try to use a
+reference that points to no location in memory (null) as though it were
+referencing an object. Calling a method on a null reference or trying to
+access a field of a null reference will trigger a NullPointerException.
+
+#+begin_src java
+ public class Example {
+ public static void main(String[] args) {
+ Object obj = null;
+ obj.hashCode();
+ }
+}
+#+end_src
+