Question: 6. (10 pts) Suppose you have the class whatever, defined below. Suppose a main method runs as follows: public static void main(String[] args) {
6. (10 pts) Suppose you have the class whatever, defined below. Suppose a main method runs as follows: public static void main(String[] args) { } Whatever w = new Whatever () ; System.out.println (w.ohReally Now (7)); System.out.println(w.ohReally Now (-5)); System.out.println(w.ohReallyNow (10)); In the box below, write down the output produced. public class Whatever { private int x; public Whatever () { x = 42; } public int ohReallyNow (int y) { int z = y; if (z z < 50) if (z > 0) { z = 0; } else { x = 137; } } return x + z;
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
