Question: Draw the memory model at checkpoint1 // In Cookie.java class Cookie { private String type; public String section = bakery; public Cookie(String t) { type
Draw the memory model at checkpoint1
// In Cookie.java class Cookie { private String type; public String section = "bakery"; public Cookie(String t) { type = t; } public boolean cookieMatch (Cookie cl, Cookie c2) { return cl.type.equals(c2.type); } public int getCalodieCount() { int calories = 200; if(type.equals("sugar free")) { calories = 50; } // Checkpoint 2 return calories; } } 11 In CookieTester.java public class CookieTester { public static void main(String[] args) { Cookie c = new Cookie("choco chip"); Cookie[] cks = new Cookie[3]; cks[0] = c; cks[1] = c; cks[2] = new Cookie("sugar free"); 1/ Checkpoint 1 int cals = cks[0].getCalorieCount(); System.out.println("Calorie count of cookie 0 is: " + cals); 000 F3 000 F4 F5 F7 FB
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
