Given the code fragment:
What is the result?
Correct Answer:
C
Given:
and the code fragment:
What is the result?
Correct Answer:
D
Given:
From what threading problem does the program suffer?
Correct Answer:
B
Given the code fragment:
Path p1 = Paths.get(“/Pics/MyPic.jpeg”); System.out.println (p1.getNameCount() + “:” + p1.getName(1) +
“:” + p1.getFileName());
Assume that the Pics directory does NOT exist.
What is the result?
Correct Answer:
B
Given:
class Bird {
public void fly () { System.out.print(“Can fly”); }
}
class Penguin extends Bird {
public void fly () { System.out.print(“Cannot fly”); }
}
and the code fragment: class Birdie {
public static void main (String [ ] args) { fly( ( ) -> new Bird ( ));
fly (Penguin : : new);
}
/* line n1 */
}
Which code fragment, when inserted at line n1, enables the Birdie class to compile?
Correct Answer:
C