Answered step by step
Verified Expert Solution
Question
1 Approved Answer
21. Consider a two-dimensional array of Clock values called allclocks. A code segment manipulating all clocks is as follows: for (Clock [] row: allClocks) for
21. Consider a two-dimensional array of Clock values called allclocks. A code segment manipulating all clocks is as follows: for (Clock [] row: allClocks) for (Clock : row) /* more code */ Assuming the clock class works as specified, which replacement for /* more code error? will cause an 1. II. System.out.print(c); C.setTime(0, 0, 0); System.out.print(c.hours); III. a. I only b. II only c. III only d. II and III only e. I and II only 22. 1 public class SomeClass { private int num; public SomeClass(int n) { num = n; } public void setToZero () { num = 0; } public int getNum() { return num; } The following code segment appears in another class. SomeClass one = new SomeClass (7); SomeClass two = new SomeClass(8); SomeClass three = two; one.setToZero(); two.setToZero ; System.out.println(one.getNum () + " " + two.getNum() + " " + three.getNum()); What is printed as a result of executing the code segment? A. 7 8 8 B. O 8 8 C. O O 8 D. 0 0 0 E. 0 0 7 U. (1 punt) Assume that x and y are variables of type int. The expression: ! (x > y) 11 ! (x y) is equivalent to which of the following? A. true B. false C. x == y D. x != y E. (x = y)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started