




Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!





Expression Value 8 + 5 * 3 / 2 _________________________ 1.5 * 4 * 7 / 8 + 3.4 _________________________ 73 % 10 6 % 10 + 28 % 3 _________________________ 4 + 1 + 9 + "." + (3 + 10) + 11 / 3 _________________________ 3 / 14 / 7 / (1.0 * 2) + 10 / 6 _________________________ 10 > 11 == 4 / 3 > 1 _________________________
public class ParameterMystery { public static void main(String[] args) { String x = "happy"; String y = "pumpkin"; String z = "orange"; String pumpkin = "sleepy"; String orange = "vampire"; orange(y, x, z); orange(x, z, y); orange(pumpkin, z, "y"); z = "green"; orange("x", "pumpkin", z); orange(y, z, orange); } public static void orange(String z, String y, String x) { System.out.println(y + " and " + z + " were " + x); } }
public static int mystery(int i, int j) { int k = 0; while (i > j) { i = i j; k = k + (i 1); } return k; } Method Call Value Returned mystery(2, 9) _______________________________ mystery(5, 1) _______________________________ mystery(38, 5) _______________________________ mystery(5, 5) _______________________________ mystery(40, 10) _______________________________
public static int mystery(Scanner console) { int y = 0; int z = 1; int next = console.nextInt(); // Point A while (next >= 0) { // Point B if (y > z) { // Point C z = y; } y++; next = console.nextInt(); // Point D } // Point E return z; } next < 0 y > z y == 0 Point A Point B Point C Point D Point E
T T T H T H H H Three heads in a row! T H T H T T T T T H H T H H H Three heads in a row!