Last login: Mon Oct 12 13:45:26 on ttys003 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 Oct 12:13:45:wrecks> B (base) MAC:Mon Oct 12:13:45:4240> jshell | Welcome to JShell -- Version 14.0.1 | For an introduction type: /help intro jshell> int x = 5; x ==> 5 jshell> // variable types must be known at compile time. jshell> while(x > 0){x++;} jshell> x x ==> -2147483648 jshell> x--; $4 ==> -2147483648 jshell> x x ==> 2147483647 jshell> Math.log(214783647, 2) | Error: | method log in class java.lang.Math cannot be applied to given types; | required: double | found: int,int | reason: actual and formal argument lists differ in length | Math.log(214783647, 2) | ^------^ jshell> Math.log(214783647)/Math.log(2) $6 ==> 27.678308914013897 jshell> Math.log(214783647)/Math.log(2) $7 ==> 27.678308914013897 jshell> Math.log( 2147483647)/Math.log(2) $8 ==> 30.999999999328196 jshell> //integers are 32 bits jshell> byte b = 1; b ==> 1 jshell> while(b > 0){b++;} jshell> b b ==> -128 jshell> b--; $12 ==> -128 jshell> b b ==> 127 jshell> short s = 1 s ==> 1 jshell> while(s > 0){s++;} jshell> s s ==> -32768 jshell> s--; $17 ==> -32768 jshell> //short is a 2 bit integer jshell> short a = 5 a ==> 5 jshell> short b = 6 b ==> 6 jshell> a + b $20 ==> 11 jshell> Long.MAX_VALUE $21 ==> 9223372036854775807 jshell> float f = 3.4; | Error: | incompatible types: possible lossy conversion from double to float | float f = 3.4; | ^-^ jshell> float f = 3.4f; f ==> 3.4 jshell> //float is a 32 bit floating point number, IEEE754 jshell> double d = 4.0; d ==> 4.0 jshell> d = "cows" | Error: | incompatible types: java.lang.String cannot be converted to double | d = "cows" | ^----^ jshell> 4*5 $24 ==> 20 jshell> 4 + 5 $25 ==> 9 jshell> 4 - 5 $26 ==> -1 jshell> 4/5 $27 ==> 0 jshell> -4/5 $28 ==> 0 jshell> 4 % 5 $29 ==> 4 jshell> 4**5 | Error: | illegal start of expression | 4**5 | ^ jshell> Math.pow(4,5) $30 ==> 1024.0 jshell> Math.cos(Math.PI) $31 ==> -1.0 jshell> Math.log(10) $32 ==> 2.302585092994046 jshell> exp(2.3025) | Error: | cannot find symbol | symbol: method exp(double) | exp(2.3025) | ^-^ jshell> Math.exp(2.3025) $33 ==> 9.999149106262607 jshell> 4.0/5 $34 ==> 0.8 jshell> true $35 ==> true jshell> false $36 ==> false jshell> 'a' $37 ==> 'a' jshell> char q = 'z' q ==> 'z' jshell> (int) q $39 ==> 122 jshell> (char) 945 $40 ==> 'α' jshell> (char) 946 $41 ==> 'β' jshell> for(int k = 945; k < 959; k++) ...> { jshell> for(int k = 945; k < 959; k++) ...> {b again to see all possible completions; total possible completions: 574> ...> System.out.print((char) k); ...> } αβγδεζηθικλμνξ jshell> for(int k = 945; k < 969; k++) ...> { ...> System.out.print((char) k); ...> } αβγδεζηθικλμνξοπρςστυφχψ jshell> for(int k = 945; k < 970; k++) ...> { ...> System.out.print((char) k); ...> } αβγδεζηθικλμνξοπρςστυφχψω jshell> (char) 5545 $45 ==> 'ᖩ' jshell> (char) 6040 $46 ==> 'ម' jshell>