Skip to content
This repository was archived by the owner on Feb 10, 2024. It is now read-only.

Commit 17ec324

Browse files
author
Ram swaroop
committed
added content
1 parent d841753 commit 17ec324

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

_posts/2015-05-14-variables-and-literals.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,22 @@ class Scope {
413413
}
414414
{% endhighlight %}
415415

416-
416+
### Variable Initialization
417+
418+
Java gives us the option of initializing a declared variable or leaving it uninitialized. When we attempt to use
419+
the uninitialized variable, we can get different behavior depending on __what type of variable or array we are dealing
420+
with (primitives or objects)__. The behavior also depends on __the level (scope) at which we are declaring our
421+
variable__.
422+
423+
Default values for Instance variables (Primitive and Non-primitive):
424+
425+
Variable Type | Default Value
426+
--------------|----------------
427+
`byte`, `short`, `int`, `long` | `0`
428+
`float`, `double` | `0.0`
429+
`boolean` | `false`
430+
`char` | `'\u0000'`
431+
Object reference | `null` (not referencing any object)
417432

418433
{% include responsive_ad.html %}
419434

0 commit comments

Comments
 (0)