This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
Which of the following statements are true? 1) The instanceof operator can be used to determine if a reference is an instance of a class, but not an interface. 2) The instanceof operator can be used to determine if a reference is an instance of a particular primitive wrapper class 3) The instanceof operator will only determine if a reference is an instance of a class immediately above in the hierarchy but no further up the inheritance chain 4) The instanceof operator can be used to determine if one reference is of the same class as another reference thus I imagined answer will be 2&4. But actual answer is only 4. Why isn't 2 also correct. Appreciate it.
pilania
Greenhorn
Joined: Mar 20, 2000
Posts: 26
posted
0
please disregard previous question. Here is right question Which of the following statements are true? 1) An interface can only contain method and not variables 2) Java does not allow the creation of a reference to an interface with the new keyword. 3) A class may extend only one other class and implement only one interface 4) Interfaces are the Java approach to addressing its single inheritance model, but require implementing classes to create the functionality of the Interfaces. I imagined asnwer to be 2&4. But 2 is wrong (At leat thats what the answer says). Can sombody explain.