MacBook-Pro:235lect02 smtuttle$ ls
GameDie.class		GameDie.java

MacBook-Pro:235lect02 smtuttle$ jshell
|  Welcome to JShell -- Version 16.0.1
|  For an introduction type: /help intro

jshell> int quant;
quant ==> 0

jshell> double price = 3.4;
price ==> 3.4

jshell> true
$3 ==> true

jshell> false
$4 ==> false

jshell> boolean flag;
flag ==> false

jshell> flag = true;
flag ==> true

jshell> flag = 1;
|  Error:
|  incompatible types: int cannot be converted to boolean
|  flag = 1;
|         ^

jshell> flag == false
$7 ==> false

jshell> flag == 0
|  Error:
|  incomparable types: boolean and int
|  flag == 0
|  ^-------^

jshell> if (!flag)
   ...> {
   ...>     System.out.println("flag was false!!");
   ...> }

jshell> if (flag)
   ...> {
   ...>     System.out.println("flag is truuuuuue!");
   ...> }
flag is truuuuuue!

jshell> if (1)
   ...> {
   ...>     System.out.println("ooo");
   ...> }
|  Error:
|  incompatible types: int cannot be converted to boolean
|  if (1)
|      ^

jshell> 1 /3
$10 ==> 0

jshell> 1.0 / 3
$11 ==> 0.3333333333333333

jshell> 1 / 3
$12 ==> 0

jshell> 531 % 2
$13 ==> 1

jshell> (1 + 3) == 4
$14 ==> true

jshell> GameDie myDie;
|  created variable myDie, however, it cannot be referenced until class GameDie is declared

jshell> /open GameDie.java

jshell> GameDie myDie;
myDie ==> null

jshell> myDie = new GameDie();
myDie ==> GameDie@4e50df2e

jshell> GameDie die2 = new GameDie();
die2 ==> GameDie@7291c18f

jshell> myDie == die2
$20 ==> false

jshell> myDie.getCurrTop() == die2.getCurrTop()
$21 ==> true

jshell> myDie.getCurrTop()
$22 ==> 1

jshell> myDie.getNumSides() == die2.getNumSides()
$23 ==> true

jshell> myDie.getNumSides()
$24 ==> 6

jshell> die2 = myDie;
die2 ==> GameDie@4e50df2e

jshell> die2
die2 ==> GameDie@4e50df2e

jshell> myDie
myDie ==> GameDie@4e50df2e

jshell> myDie == die2
$28 ==> true

jshell> "die".equals("die")
$29 ==> true

jshell> true and false
|  Error:
|  ';' expected
|  true and false
|      ^
|  Error:
|  not a statement
|  true and false
|       ^-^
|  Error:
|  ';' expected
|  true and false
|          ^

jshell> true && false
$30 ==> false

jshell> true || false
$31 ==> true

jshell> true or false
|  Error:
|  ';' expected
|  true or false
|      ^
|  Error:
|  not a statement
|  true or false
|       ^^
|  Error:
|  ';' expected
|  true or false
|         ^

jshell> Math.sqrt(34)
$32 ==> 5.830951894845301

jshell> sqrt(34)
|  Error:
|  cannot find symbol
|    symbol:   method sqrt(int)
|  sqrt(34)
|  ^--^

jshell> "die".equals("d" + "ie")
$33 ==> true

jshell> String looky;
looky ==> null

jshell> looky = "moo";
looky ==> "moo"

jshell> looky = "moo" + "!";
looky ==> "moo!"

jshell> Scanner in;
in ==> null

jshell> in = new Scanner(System.in);
in ==> java.util.Scanner[delimiters=\p{javaWhitespace}+] ... \E][infinity string=\Q∞\E]

jshell> int age = in.nextInt();
59
age ==> 59

jshell> GameDie quad;
quad ==> null

jshell> quad.roll()
|  Exception java.lang.NullPointerException: Cannot invoke "REPL.$JShell$30$GameDie.roll()" because "REPL.$JShell$56.quad" is null
|        at (#41:1)

jshell> quad = new GameDie(4);
quad ==> GameDie@17d10166

jshell> quad.roll()
$43 ==> 4

jshell> int a[];
a ==> null

jshell> a = new int[100];
a ==> int[100] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... , 0, 0, 0, 0, 0, 0, 0, 0 }

jshell> a[2] = 13;
$46 ==> 13

jshell> a
a ==> int[100] { 0, 0, 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }

jshell> int []b;
b ==> null

jshell> int c[];
c ==> null

jshell> a.length == 100
$50 ==> true

jshell>  b.length ==    3
|  Exception java.lang.NullPointerException: Cannot read the array length because "REPL.$JShell$64.b" is null
|        at (#51:1)

jshell> b
b ==> null

jshell>  b =    new int[3]; 
b ==> int[3] { 0, 0, 0 }

jshell> b.length == 3
$54 ==> true

jshell> b[4] = 13;
|  Exception java.lang.ArrayIndexOutOfBoundsException: Index 4 out of bounds for length 3
|        at (#55:1)

jshell> b[-1] = 2;
|  Exception java.lang.ArrayIndexOutOfBoundsException: Index -1 out of bounds for length 3
|        at (#56:1)

jshell> ArrayList<GameDie> dice = new ArrayList<GameDie>();
dice ==> []

jshell> dice.add(new GameDie(10));
$58 ==> true

jshell> dice
dice ==> [GameDie@123772c4]

jshell> dice.add(new GameDie());
$60 ==> true

jshell> dice.size()
$61 ==> 2

jshell> dice.get(0)
$62 ==> GameDie@123772c4

jshell> dice.get(0).getNumSides()
$63 ==> 10

jshell> dice.get(1).roll()
$64 ==> 3

jshell> dice.get(1).roll()
$65 ==> 4

jshell> dice.get(1).roll()
$66 ==> 6

jshell> dice.get(1).roll()
$67 ==> 6

jshell> dice.get(1).roll()
$68 ==> 3

jshell> dice.remove(0)
$69 ==> GameDie@123772c4

jshell> dice
dice ==> [GameDie@200a570f]

jshell> dice.size()
$71 ==> 1

jshell>