Question
Question 111 pts Which Java keyword can be used to access the super class version of an overridden method from within the sub class? override
Question 111 pts
Which Java keyword can be used to access the super class version of an overridden method from within the sub class?
override |
super |
new |
this |
extends |
Flag this Question
Question 121 pts
Given the following code (assume that the statements compile with NO syntax errors):
Red hot = new Red(); Green top = hot; Orange ocean = new Blue(); hot = ocean;
What is the static type of 'top'?
Green |
hot |
Red |
top |
Flag this Question
Question 131 pts
Given the following code (assume that the statements compile with NO syntax errors):
Red hot = new Red(); Green top = hot; Orange ocean = new Blue(); hot = ocean;
What is the dynamic type of 'ocean' after all the statements have been executed? (Tip: draw an object diagram!)
Orange |
hot |
Red |
Blue |
Flag this Question
Question 141 pts
Given the following code (assume that the statements compile with NO syntax errors):
Red hot = new Red(); Green top = hot; Orange ocean = new Blue(); hot = ocean;
What is the dynamic type of 'hot' after all the statements have been executed? (Tip: draw an object diagram!)
Red |
ocean |
Blue |
Orange |
Flag this Question
Question 151 pts
What determines which version of an overridden method is executed?
the static type of the variable that acts as the 'qualifier' in the method call |
the dynamic type of the variable that acts as the 'qualifier' in the method call |
the data types of the arguments of the method call |
the name of the class where the method call is located |
the name of the method |
Flag this Question
Question 161 pts
What determines which version of an overloaded method is executed?
the static type of the variable that acts as the 'qualifier' in the method call |
the dynamic type of the variable that acts as the 'qualifier' in the method call |
the data types of the arguments of the method call |
the name of the class where the method call is located |
the name of the method |
Flag this Question
Question 171 pts
A programmer writing code in class Point attempts to override the following inherited method: public boolean equals( Object o ) { ... } but does not match the method signature exactly. Instead, the programmer uses the following method signature: public boolean equals( Point p ) { ... } What is the result?
A syntax error occurs because the method signatures do not match. |
The code compiles and works fine -- the method has been successfully overridden. |
The code compiles, but the inherited method has not been overridden -- it has been overloaded instead. |
The compiler automatically changes the method signature to match the inherited method. |
The compiler issues a warning, but the method is successfully overridden. |
Flag this Question
Question 181 pts
Given the following class hierarchy: Siamese "Is-A" Feline "Is-A" Mammal "Is-A" LivingThing Which of the following is true?
( new Mammal() ) instanceof LivingThing |
( new Feline() ) instanceof LivingThing |
( new Siamese() ) instanceof LivingThing |
All of the above |
None of the above |
Flag this Question
Question 191 pts
A type cast using reference type is a promise to the compiler that the dynamic type of the expression will conform to the type specified in the cast. What happens if this promise is broken?
A syntax error will occur. |
The dynamic type will be changed to match the type specified in the cast. |
A ClassCastException will be thrown. |
The JRE will request a replacement type from the user. |
The type cast will be ignored. |
Flag this Question
Question 201 pts
How many different classes can a sub class derive from, using the keyword extends?
A sub class can extend directly from mutliple super classes. |
exactly one class |
any number of classes as long as an import statement is used |
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started