Access over 20 million homework & study documents

3 18A threads run() method includes the following linestry {

Content type
User Generated
Rating
Showing Page:
1/7
3.18
A thread\'s run() method includes the following lines:
try {
sleep(100);
} catch (InterruptedException e) { }
Assuming the thread is not interrupted, which one of the
following statements is correct?
A)The code will not compile, because exceptions may not
be caught in a thread\'s method.
B)At line 2, the thread will stop running. Execution will
resume in, at most, 100 milliseconds.
At line 2, the thread will stop running. It will resume
running in exactly 100 milliseconds.
D)At line 2, the thread will stop running. It will resume
running some time after 100 milliseconds have elapsed.
3.19
package com.dan.chisholm; public class A {
public void m1() {System.out.print(\"A.m1, \");} protected
void m2() {System.out.print(\"A.m2, \");} private void m3()
{System.out.print(\"A.m3, \");} void m4()
{System.out.print(\"A.m4, \");}
} class B {
public static void main(String[] args) { A a = new A();
a.m1(); // 1
a.m2(); // 2
a.m3(); // 3
a.m4(); // 4 }}
Assume that the code appears in a single file named
A.java. What is the result of attempting to compile and run
the program?
a.Prints: A.m1, A.m2, A.m3, A.m4,
b.Compile-time error at 1.
c.Compile-time error at 2.

Sign up to view the full document!

lock_open Sign Up
Showing Page:
2/7
Compile-time error at 3.
e.Compile-time error at 4.
f.None of the above
3.20
class GFM11{
public static void main (String[] args) {
int x,y,z;
System.out.println(x+y+z); }}
What is the result of attempting to compile and run the
program? a. Prints nothing.
b.Prints an undefined value.
c.Prints: null
d.Prints: 0
e.Run-time error
Compile-time error
g.None of the above
3.21
class GRC10 {
public static void main (String[] s) {
System.out.print(s[1] + s[2] + s[3]);
}}
java GRC10 A B C D E F
What is the result of attempting to compile and run the
program using the specified command line?
a. Prints: ABC
Prints: BCD
c.Prints: CDE
d.Prints: A B C
e.Prints: B C D
f.Prints: C D E
g.Compile-time error
h.Run-time error
3.22
class MWC101 {
public static void main(String[] args) { int[] a1 = new

Sign up to view the full document!

lock_open Sign Up
Showing Page:
3/7

Sign up to view the full document!

lock_open Sign Up
End of Preview - Want to read all 7 pages?
Access Now
Unformatted Attachment Preview
3.18 A thread\'s run() method includes the following lines: try { sleep(100); } catch (InterruptedException e) { } Assuming the thread is not interrupted, which one of the following statements is correct? A)The code will not compile, because exceptions may not be caught in a thread\'s method. B)At line 2, the thread will stop running. Execution will resume in, at most, 100 milliseconds. At line 2, the thread will stop running. It will resume running in exactly 100 milliseconds. D)At line 2, the thread will stop running. It will resume running some time after 100 milliseconds have elapsed. 3.19 package com.dan.chisholm; public class A { public void m1() {System.out.print( \"A.m1, \");} protected void m2() {System.out.print(\"A.m2, \");} private void m3() {System.out.print(\"A.m3, \");} void m4() {System.out.print(\"A.m4, \");} } class B { public static void main(String[] args) { A a = new A(); a.m1(); // 1 a.m2(); // 2 a.m3(); // 3 a.m4(); // 4 }} Assume that the code appears in a single file named A.java. What is the result of attempting to compile and run the program? a.Prints: A.m1, A.m2, A.m3, A.m4, b.Compile-time error at 1. c.Compile-time error at 2. Compile-time error at 3. e.Compile-time error at 4. f.None of the above 3.20 class GFM11{ public static void main (String[] args) { int x,y,z; System.out.println(x+y+z); }} What is the result of attempting to compile and run the program? a. Prints nothing. b.Prints an undefined value. c.Prints: null d.Prints: 0 e.Run-time ...
Purchase document to see full attachment
User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

Anonymous
Just what I was looking for! Super helpful.

Studypool
4.7
Trustpilot
4.5
Sitejabber
4.4