Last login: Wed Oct 6 11:03:02 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:Wed Oct 06:14:05:~> jshell | Welcome to JShell -- Version 15.0.1 | For an introduction type: /help intro jshell> x = 5; | Error: | cannot find symbol | symbol: variable x | x = 5; | ^ jshell> int x = 5; x ==> 5 jshell> c | Error: | cannot find symbol | symbol: variable c | c | ^ jshell> x x ==> 5 jshell> while(x > 0){x++;} jshell> x x ==> -2147483648 jshell> byte b = 1 b ==> 1 jshell> while(b > 0){b++;} jshell> b b ==> -128 jshell> b - 1 $8 ==> -129 jshell> //arithmetic on short types promotes to int. jshell> b b ==> -128 jshell> b-- $10 ==> -128 jshell> b b ==> 127 jshell> short s = 1 s ==> 1 jshell> while(s > 0){s++;} jshell> s s ==> -32768 jshell> long l = 1; l ==> 1 jshell> for(int k = 0; k < 60; k++){l *=2;} jshell> l l ==> 1152921504606846976 jshell> l *= 2 $18 ==> 2305843009213693952 jshell> l *= 2 $19 ==> 4611686018427387904 jshell> l *= 2 $20 ==> -9223372036854775808 jshell> float f = 1; f ==> 1.0 jshell> // single precision 32 bit IEEE754 floating point number jshell> double d = 1 d ==> 1.0 jshell> //double precision 64 bit IEEE754 floating point number jshell> 5 < 6 $23 ==> true jshell> 5 <= 6 $24 ==> true jshell> 5 < 6.0 $25 ==> true jshell> $23 $23 ==> true jshell> char quack = 'a'; quack ==> 'a' jshell> (int) quack $28 ==> 97 jshell> (char) 945 $29 ==> 'α' jshell> (char) 946 $30 ==> 'β' jshell> (char) 947 $31 ==> 'γ' jshell> (char) 948 $32 ==> 'δ' jshell> (char) 5280 $33 ==> 'ᒠ' jshell> String s = "snake eyes"; s ==> "snake eyes" jshell> s[0] | Error: | array required, but java.lang.String found | s[0] | ^--^ jshell> s.charAt(0) $35 ==> 's' jshell> //indexing is happily the same! jshell> s.length() $36 ==> 10 jshell> "big" + " fat " + "surprise" $37 ==> "big fat surprise" jshell> //+ concatenates strings jshell> 4 + 5 $38 ==> 9 jshell> 4*5 $39 ==> 20 jshell> 4 -5 $40 ==> -1 jshell> 4/5 $41 ==> 0 jshell> (float) 4/5 $42 ==> 0.8 jshell> 365%7 $43 ==> 1 jshell> 2**10 | Error: | illegal start of expression | 2**10 | ^ jshell> Math.pow(2,10) $44 ==> 1024.0 jshell> Math.cos(0) $45 ==> 1.0 jshell> Math.sin(0) $46 ==> 0.0 jshell> Math.sin(90) $47 ==> 0.8939966636005579 jshell> ArrayList al = new ArrayList<>(); al ==> [] jshell> al al ==> [] jshell> al.add("cows"); $50 ==> true jshell> al al ==> [cows] jshell> al.add("horses"); $52 ==> true jshell> al al ==> [cows, horses] jshell> al.add(1, "pigs"); jshell> al al ==> [cows, pigs, horses] jshell> al.size() $56 ==> 3 jshell> al.add(42); | Error: | incompatible types: int cannot be converted to java.lang.String | al.add(42); | ^^ jshell> //ArrayList T is type parameter jshell> //homogeneous sequence type jshell> al[0] | Error: | array required, but java.util.ArrayList found | al[0] | ^---^ jshell> al.get(0) $57 ==> "cows" jshell> al.set(0, "bovines"); $58 ==> "cows" jshell> al al ==> [bovines, pigs, horses] jshell> (base) MAC:Wed Oct 06:14:56:~> ls 20212022 211 4240Chapter5.cmproj ACSL Applications BCA CLASSES Classes20161017 Classes20172018 Classes20182019 Classes20192020 Classes20202021 Copy.java D3Book DNS.txt Desktop Documents Downloads EBOOKS Empty.class Empty.java Example.java Foo.java FrameExample.java Gotwals.java Hello.java HelloFX.java IdeaProjects IfConfig.txt Ken2019.jpg Library Main.java Math-for-Programmers Movies Music NetBeansProjects OReilly Pictures Point.java Point.py Postman Projects Public PycharmProjects Qt Sites SwingExample.java Top.txt Tutorial.scala VirtualBox VMs abby.jpeg acsl.py anaconda3 api_key.txt att.txt attUpgrade.txt bash beacon.txt bin birken.c book car cartopy ce change.sh check.py client.py codeWars com.paloaltonetworks.GlobalProtect.settings.plist commando.py compilePackagesInJava computeSize.awk copy.gif copyGif.py costco.txt cpp data dataviz-with-python-and-js debug_drv.log dg die_now.py doc.html doc.html.out donut.jpeg dot driver.py ducats dukeforest dynamicProgramming easy.py emmaTova.jpeg estate euler exp.py file.txt firstName.py fixmain flush.css flush.html flyboy.html fns.py foo fun.py fxml gator go grad19 grandpa.txt igcc-0.2 iguana index.php inputDemo.css inputDemo.html inputDemo.js insult.js javafx javafx-sdk-15 javafx.bat javafxc.bat jbr_err_pid11266.log junk.js junk.txt jupiter lab1.css lab1.html lanois lib.py licenses listGames mahlin.docx makeFX.py mateFools.py matt.py mbox medium medium.py mess.gif miniterm minted move nasty.c nbbuild nbi net.py newEdition node_modules nom note.txt nude.css nude.html nude.js orphans.txt package-lock.json pasta patient.jpg phone.txt phony php picky.py pix platform profiler programming project pygame pyqt pythontools qt5 rh.py rhino.gif roster.txtc rs.py rust scipy second.txt show.py sim.py skeleton.sh snark.jpeg startPage.html swift teaching tfst.c three.py tigger.jpg tkinter tree.py tree1.py triangle.py turtle.pdf typescript ul urllib vsedit vsexperiment webcrawler websvccommon wills_and_estates yertle.py youTube (base) MAC:Wed Oct 06:14:56:~> vi Empty.java (base) MAC:Wed Oct 06:14:57:~> !jsh jshell | Welcome to JShell -- Version 15.0.1 | For an introduction type: /help intro jshell> /open Empty.java jshell> Empty e = new Empty(); e ==> Empty@37f8bb67 jshell> System.out.println(e) REPL.$JShell$11$Empty@37f8bb67 jshell> e.toString() $4 ==> "Empty@37f8bb67" jshell> (base) MAC:Wed Oct 06:15:00:~> vi Stupid.java (base) MAC:Wed Oct 06:15:01:~> javac Stupid.java (base) MAC:Wed Oct 06:15:02:~> java Stupid Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 7 at java.base/java.lang.StringLatin1.charAt(StringLatin1.java:48) at java.base/java.lang.String.charAt(String.java:712) at Stupid.main(Stupid.java:7) (base) MAC:Wed Oct 06:15:02:~> vi Stupid.java (base) MAC:Wed Oct 06:15:13:~>