Last login: Fri Oct 8 14:28:20 on ttys002 The default interactive shell is now zsh. To update your account to use zsh, please run `chsh -s /bin/zsh`. For more details, please visit https://support.apple.com/kb/HT208050. (base) MAC:Fri Oct 08:14:42:~> jshell | Welcome to JShell -- Version 15.0.1 | For an introduction type: /help intro jshell> //Arrays jshell> int[] arr = new int[10]; arr ==> int[10] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } jshell> booolean[] arr = new boolean[10]; | Error: | cannot find symbol | symbol: class booolean | booolean[] arr = new boolean[10]; | ^------^ jshell> boolean[] arr = new boolean[10]; arr ==> boolean[10] { false, false, false, false, false, ... lse, false, false, false } jshell> String[] foo = new String[10]; foo ==> String[10] { null, null, null, null, null, null, null, null, null, null } jshell> arr[10] | Exception java.lang.ArrayIndexOutOfBoundsException: Index 10 out of bounds for length 10 | at (#4:1) jshell> arr[0] $5 ==> false jshell> arr[0] = true $6 ==> true jshell> arr arr ==> boolean[10] { true, false, false, false, false, false, false, false, false, false } jshell> //fixed size HOMOgeneous sequence type. Indexing by [] jshell> foo[0].length() | Exception java.lang.NullPointerException: Cannot invoke "String.length()" because "REPL.$JShell$12.foo[0]" is null | at (#8:1) jshell> for(int k = 0; k < foo.length; k++){foo[k] = Integer.toString(k*k*k)} | Error: | ';' expected | for(int k = 0; k < foo.length; k++){foo[k] = Integer.toString(k*k*k)} | ^ jshell> for(int k = 0; k < foo.length; k++){foo[k] = Integer.toString(k*k*k);} jshell> foo foo ==> String[10] { "0", "1", "8", "27", "64", "125", "216", "343", "512", "729" } jshell> System.out.println(foo); [Ljava.lang.String;@7dc5e7b4 jshell> Arrays.toString(foo) $12 ==> "[0, 1, 8, 27, 64, 125, 216, 343, 512, 729]" jshell> foo[0] = "tapir"; $13 ==> "tapir" jshell> Arrays.toString(foo) $14 ==> "[tapir, 1, 8, 27, 64, 125, 216, 343, 512, 729]" jshell> Arrays dead = new Arrays(); | Error: | Arrays() has private access in java.util.Arrays | Arrays dead = new Arrays(); | ^----------^ jshell> Math doomed = new Math() | Error: | Math() has private access in java.lang.Math | Math doomed = new Math(); | ^--------^ jshell> /dig | Invalid command: /dig | Type /help for help. jshell> exit | Error: | cannot find symbol | symbol: variable exit | exit | ^--^ jshell>