InterviewSolution
Saved Bookmarks
| 1. |
the static method returns a reference to the currently executing object. What is the result of this code? |
| Answer» D. The sleep() method must be enclosed in a try/catch block, or the method printAll() must declare it throws the InterruptedException. A is incorrect, but it would be correct if the InterruptedException was dealt with. B is incorrect, but it would still be incorrect if the InterruptedException was dealt with because all Java code, including the main() method, runs in threads. C is incorrect. The sleep() method is static, so even if it is called on an instance, it still always affects the currently executing thread. | |