Java Reference
In-Depth Information
3.
4. public void setBrowser(Browser b) {
5. browser = b;
6. }
7.
8. public static void main(String [] args) {
9. OperatingSystem os = new OperatingSystem();
10. os.setBrowser(___________________);
11. }
12. }
which of the following statements can appear in the blank on line 10 so that the
OperatingSystem class compiles successfully?
A. new Browser()
B. new Firefox()
C. new IE()
D. new Object()
E. new String(“Hello“)
18. Given the following class definitions:
1. import java.util.Stack;
2.
3. public class FairyTale {
4. public static void main(String [] args) {
5. Stack<FairyTale> tales =
6. new Stack<FairyTale>();
7. tales.add(___________________);
8. }
9. }
10.
11. class SnowWhite extends FairyTale {}
12.
13. class Cinderella {}
which of the following statements can appear in the blank on line 7 so that the code
compiles successfully? (Select all that apply.)
A. new Cinderella()
B. new SnowWhite()
C. new FairyTale()
D. None of the above
Search WWH ::




Custom Search