aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes mock question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "mock question" Watch "mock question" New topic
Author

mock question

pilania
Greenhorn

Joined: Mar 20, 2000
Posts: 26
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
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.
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Please see the discussion here http://www.javaranch.com/ubb/Forum24/HTML/000926.html
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: mock question