Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Doubt in Mock Question

 
raja ram
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have taken this questions from Marcus

1.A session attribute can store either a class or primitive type ?

My answer for this is TRUE, because in the below code i am getting

out put as 10. but the answer given is FASLE

2.which of the following will set the Content type to Image/GIF


My answer is both but answer given is setContentType() why is it so?

Thanks
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by raja ram:

1.A session attribute can store either a class or primitive type ?


Actually,you can store any kind of object in session not premitive.

if you use jdk 1.5 or higher version then it automatically unbox the premitive to object


2.which of the following will set the Content type to Image/GIF


My answer is both but answer given is setContentType() why is it so?



Hmmm.... i think you are right
 
raja ram
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
As this is SCWCD 1.5 exam,the answer to the first Question will be True.We can store primatives in session, is that correct?

Thanks
 
Michael Ku
Ranch Hand
Posts: 510
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What happened when you tried to execute the code yurself?
 
Swathi Sri
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
According to the explanation, the answer to first question should be True.
 
Michael Ku
Ranch Hand
Posts: 510
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What happened when you tried to execute the code yourself?


the blackboard vs the keyboard :-)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic