Answers to Questions
Q1 |
(a), (b), (c), and (e)
Only local variables need to be explicitly initialized before use. Fields are assigned a default value if not explicitly initialized. |
Q2 |
(a), (d), and (e)
When the >> operator shifts bits to the right, it fills the new bits on the left with the bit value of the left-most bit of the original bit pattern. When the >>> operator shifts bits to the right, it always fills the new bits on the left with a bit value of 0. Thus, the >> and the >>> operators perform the same operation when the left-most bit of the original bit pattern has a bit value of 0. This occurs whenever the original value is non-negative. The result of (-1 >> 1) is –1. A bit pattern consisting of all 1s (i.e., integer -1) will not change ... |
Get Programmer's Guide to Java™ Certification, A: A Comprehensive Primer, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.