One-page version suitable for printing.
Statistics:
mean 21.667 (650.000/30) stddev 3.618 median 21.000 midrange 18.000-24.000 # avg 1 6.63 / 10 2 7.8 / 10 3 7.23 / 10
Suppose a user executes the following run() method.
public static void run() { String str = "arboreteum"; int j = 0; for(int i = 0; i < str.length(); i++) { if(str.charAt(i) == 'e') { IO.print(str.substring(j, i)); j = i + 1; } } IO.println(str.substring(j)); }
i j
Say we've defined the following method.
public static int f(int n) { IO.println(n); return n / 2; }
IO.println(1 + f(1 + f(16)));
What does the following method print?
import csbsju.cs160.*; public class Q3 { public static void run() { Account a = new Account(); a.deposit(4.0); Account b = new Account(); b.deposit(8.0); Account c = b; b = a; b.deposit(2.0); IO.println(a.getBalance()); IO.println(b.getBalance()); IO.println(c.getBalance()); } }