Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Doubt in a mock exam question

 
Rancy Chadha
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I have a doubt regarding a question from 'http://www.javaranch.com/carl/SCWCD.htm' mock exam. This is the 29th question, it goes like this:

Which statements are correct regarding the following jsp lines that use a tag library?
<%! Vectot vector =new java.util.Vector();%>
<% vector.addElement(�one�); vector.addElement(�two�); %>
<prefix:suffix attr='vector' />

1) A vector can't be assigned to a tag handler attribute
2) The program will compile and assign the vector's content to the attribute attr.
3) The program will assign the content of vector if assigment is: attr='<%= vector %>'

The answer of this quesion is option 3.
My doubt is, Why is option 2 not correct. Why doesnt the code work with variable vector assigned to the attribute.
Please clear my doubt.
 
arun shanmugam kumar
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The option says the value of vector variable will be assigned to attr but thats false.
According to the code attr will have the value 'vector' and not the contents of vector reference variable.
Thats why option 2 is wrong.
 
Joe Harry
Ranch Hand
Posts: 10124
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
By the way what it means to say <prefix:suffix attr='vector' />??
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic