• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Question about jsp:useBean

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am preapring for web component certification and I have a question from a mock exam which confused me. This is the question with the answer:


Given:
<jsp:useBean id="baz" class="com.test.Test" type="com.test.Bar" />

Which two are true? (Choose two)

A. An object of type com.test.Test is instantiated and assigned to a variable baz of type com.test.Bar.
B. An object of type com.test.Bar is instantiated and assigned to a variable baz of type com.test.Test.
C. To avoid error, com.test.Bar must be superclass of com.test.Test or an interface implemented by com.test.Test.
D. To avoid error, com.test.Test must be a superclass of com.test.Bar or an interface implemented by com.test.Bar.

Answer: B, D


In my opinion the correct answers are A and C not B, D as it is written in the mock exam. Am I right ? Please help me!
 
Ranch Hand
Posts: 277
Oracle Spring Flex
  • Likes 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes you are right. Correct answer is A,C.
We try to create object for the Test Class and reference it to Bar class/interface variable baz. OO Concept - Dynamic Polymorphism.
So, Bar can be either abstract class which is extended by Test Class or Interface implemented by Test Class or simply any class or interface higher up in the inheritance hierachy of Test Class.
 
Botez Nicolae
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks a lot!
 
Ranch Hand
Posts: 78
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes nicolae, you are right. The correct answers are A and C. Some times authors will make mistakes and some times that is intentional it seems, don't get confused and stick to your basics.
 
reply
    Bookmark Topic Watch Topic
  • New Topic