Entry Access
jshell> int[] arr = {2,3,4,5,6,7}
arr ==> int[6] { 2, 3, 4, 5, 6, 7 }
jshell> arr.length
$2 ==> 6
jshell> arr[0] = 20;
$3 ==> 20
jshell> arr
arr ==> int[6] { 20, 3, 4, 5, 6, 7 }
jshell> arr[1:3]
| Error:
| ']' expected
| arr[1:3]
| ^
jshell> int[] brr = new int[10];
brr ==> int[10] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
jshell> brr
brr ==> int[10] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
jshell> boolean[] boo = new boolean[10];
boo ==> boolean[10] { false, false, false, false, false, ... lse, false, false, false }
jshell> System.out.println(brr)
[I@34c45dca
jshell> System.out.println(boo)
[Z@5b6f7412
jshell> String[] strArray = new String[10];
strArray ==> String[10] { null, null, null, null, null, null, null, null, null, null }
jshell> String[] list = {"aardvark", "bengal", "carical", "dingo"};
list ==> String[4] { "aardvark", "bengal", "carical", "dingo" }
jshell> list[2]
$12 ==> "carical"
jshell> list[2] = "cheetah"
$13 ==> "cheetah"
jshell> list
list ==> String[4] { "aardvark", "bengal", "cheetah", "dingo" }
jshell>
args
Matey, I'm a pirate!
for
The Ovipositor
The dreaded NullPointerException
The static serivce class Arrays