Last login: Mon Apr 19 08:42:12 on ttys001 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:Mon Apr 19:09:43:~> jshell | Welcome to JShell -- Version 15.0.1 | For an introduction type: /help intro jshell> Math.pow(3,5) $1 ==> 243.0 jshell> Math.E $2 ==> 2.718281828459045 jshell> Math.PI $3 ==> 3.141592653589793 jshell> Math.PI = 3 | Error: | cannot assign a value to final variable PI | Math.PI = 3 | ^-----^ jshell> Math.cos(Math.PI) $4 ==> -1.0 jshell> ArrayList foo = new ArrayList<>(); | Error: | unexpected type | required: reference | found: int | ArrayList foo = new ArrayList<>(); | ^-^ jshell> ArrayList foo = new ArrayList<>(); foo ==> [] jshell> foo.add(5); $6 ==> true jshell> foo foo ==> [5] jshell> foo.add(3443) $8 ==> true jshell> foo.add(42) $9 ==> true jshell> foo foo ==> [5, 3443, 42] jshell> //you can only make array lists of object types jshell> //you can't make an array list of priimitive type jshell> int quack = Integer.parseInt("345"); quack ==> 345 jshell> quack quack ==> 345 jshell> Integer.toString(543) $13 ==> "543" jshell> Integer.toString(543, 16) $14 ==> "21f" jshell> Integer.toString(543, 2) $15 ==> "1000011111" jshell> Integer.toString(543, 6) $16 ==> "2303" jshell> Integer.MAZ_VALUE | Error: | cannot find symbol | symbol: variable MAZ_VALUE | Integer.MAZ_VALUE | ^---------------^ jshell> Integer.MAx_VALUE | Error: | cannot find symbol | symbol: variable MAx_VALUE | Integer.MAx_VALUE | ^---------------^ jshell> Integer.MAX_VALUE $17 ==> 2147483647 jshell> Integer.MIN_VALUE $18 ==> -2147483648 jshell> Integer z = 4; z ==> 4 jshell> z.getClass() $20 ==> class java.lang.Integer jshell> //autoboxing: tacit call to new jshell> int m = z; m ==> 4 jshell> m.getClass(0 ...> ) | Error: | int cannot be dereferenced | m.getClass(0 | ^--------^ jshell> m.getClass() | Error: | int cannot be dereferenced | m.getClass() | ^--------^ jshell> //autounboxing jshell> int left = 6 left ==> 6 jshell> Integer droit = 6; droit ==> 6 jshell> Integer gauche = 6; gauche ==> 6 jshell> droit == gauche $25 ==> true jshell> droit.equals(gauche) $26 ==> true jshell>