//extra TA office hours tomorrow //helper methods? //recall pizza class: Pizza p = new Pizza(3, "large"); p.addTopping("mushrooms"); p.addTopping("cheese") p.addTopping("green peppers") p.addTopping("green peppers") Pizza p = new Pizza(3, "large"); p.toString() p.addTopping("green peppers") p.addTopping("cheese") p.toString() //let's write removeTopping method // make that toping null, then fill the hole with the last element //we could shift back the rest to fill the hole, but the order of //topping doesn't matter, so why make it slow! Pizza p = new Pizza(3, "large"); p.addTopping("a"); p.addTopping("b"); p.addTopping("c"); p.toString() p.removeTopping("c") p.toString() p.removeTopping("a") p.toString() p.removeTopping("b") p.toString() p.removeTopping("b") p.toString() //2d arrays int[] a = new int[4]; a[0] a[1] int[][] b = new int[3][4]; b b[0] b[1] b[2] b[0][0] b[1][0] b[2][0] b[3][0] b[2][3] b[2][4] b[2][3] = 4; b[1][2] = 34; // b is a 2D (2 dimensional) array // b has 3 rows, 4 columns: 12 elements // A 2D array is an "array of arrays" b a.length b.length b[0].length b[1].length b[2].length int[][] c = new int[3][]; c c[0] c[0] = new int[4]; c[1] = new int[500]; c[2] = new int[3]; c.length c[0].length c[1].length c[2].length