Last login: Tue Oct 12 09:14:22 on ttys000 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:Tue Oct 12:09:20:~> jshell | Welcome to JShell -- Version 15.0.1 | For an introduction type: /help intro jshell> ArrayList al = new ArrayList<>(); al ==> [] jshell> al.add(new ArrayList()) | Error: | incompatible types: java.util.ArrayList cannot be converted to java.lang.String | al.add(new ArrayList()) | ^---------------------^ jshell> al.add("hello") $2 ==> true jshell> al.add("goodbye") $3 ==> true jshell> ArrayList nums = new ArrayList(); | Error: | unexpected type | required: reference | found: int | ArrayList nums = new ArrayList(); | ^-^ | Error: | unexpected type | required: reference | found: int | ArrayList nums = new ArrayList(); | ^-^ jshell> ArrayList = new ArrayList<>(); | Error: | illegal start of expression | ArrayList = new ArrayList<>(); | ^ | Error: | cannot find symbol | symbol: variable ArrayList | ArrayList = new ArrayList<>(); | ^-------^ | Error: | cannot find symbol | symbol: variable Integer | ArrayList = new ArrayList<>(); | ^-----^ jshell> ArrayList nums = new ArrayList<>(); nums ==> [] jshell> Integer.MAX_VALUE $5 ==> 2147483647 jshell> Integer.MIN_VALUE $6 ==> -2147483648 jshell> Integer i = 4; i ==> 4 jshell> //this is called autoboxing jshell> int p = 4; p ==> 4 jshell> p.getClass() | Error: | int cannot be dereferenced | p.getClass() | ^--------^ jshell> i.getClass() $9 ==> class java.lang.Integer jshell> int q = i; q ==> 4 jshell> q q ==> 4 jshell> //autounboxing jshell> Integer.sgn(q) | Error: | cannot find symbol | symbol: method sgn(int) | Integer.sgn(q) | ^---------^ jshell> Integer.signum(q) $12 ==> 1 jshell> Integer.signum(-3) $13 ==> -1 jshell> Integer.signum(0) $14 ==> 0 jshell> Integer.toString(42) $15 ==> "42" jshell> Integer.parseInt("3214") $16 ==> 3214 jshell> Integer.parseInt("cows") | Exception java.lang.NumberFormatException: For input string: "cows" | at NumberFormatException.forInputString (NumberFormatException.java:68) | at Integer.parseInt (Integer.java:652) | at Integer.parseInt (Integer.java:770) | at (#17:1) jshell> jshell> Double.parseDouble("6.02e23") $18 ==> 6.02E23 jshell> Boolean.parseBoolean("true") $19 ==> true jshell> /imports | import java.io.* | import java.math.* | import java.net.* | import java.nio.file.* | import java.util.* | import java.util.concurrent.* | import java.util.function.* | import java.util.prefs.* | import java.util.regex.* | import java.util.stream.* jshell>