Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JWeb+ Question

 
Rishi Yagnik
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all
Question is as follows :

Step 1<%! int sum = 0 ;%>
Step 2<% int sum = 0 ;%>
Optios are as follows :
1)By removing one of then page will compile properly
2)It can not occur in same jsp page
3)Step 1 is a declaration and Step 2 is a scriptlet
4)Step 1 is a scriptlet and Step 2 is a declaration
select 2 ans
I fill ans 3 is a valid but which is the other one
I fill both can occur in a same jsp page and by having tham in a same jsp page compliation of page will not be a problem.
am i missing something.........
Rishi
 
Bhushan Jawle
Ranch Hand
Posts: 252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Interesting, even I think only option 3 is valid, I even actually tried it out didn't get any error.
There is only one valid stmt. in given options.
Bhushan
 
Dharmin Desai
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi rishi,
Hope u can recall me. We hv talked on phone once for that SCWCD Manning book.
Now again i need yr help.
As far as i know, JWEB+ is a commercial exam. Could u share JWEB+ software with me, as i m also appearing for SCWCD ?
I m really greatful if we can talk on phone once again for this JWEB+ exam kit.
please tell me yr mobile no once again.
- Dharmin
 
Mark Howard
Ranch Hand
Posts: 285
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rishi
There's nothing particularly wrong with option 1 either. It may not be necessary to remove one of the two declarations in order for the page to translate/compile correctly, but it will work
Mark.
 
Vidya Nayak
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mark, you are right. The one in the scriptlet will be local variable and the one in declaration will be instance varible when the jsp file is translated into servlet. That is why removing one of the variables will compile fine.
Cheers,
Vidya
 
Rishi Yagnik
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Vidhya
did you tried my example
it works fine by having both in the same page
i think u read the mark'post wrongly
Rishi
 
Vidya Nayak
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rishi,
Option 2 and 4 are definitely wrong. option 3 is correct. option 1 is correct in the sense if one of them is removed the program will still compile ok. It does not negate the fact that if both are present jsp won't compile. This argument of course based on the available options and # to choose.
Hope this is clear.
ta
Vidya
 
Dharmin Desai
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear rishi,
I fully agree with vidya
option 1 is correct in the sense if one of them is removed the program will still compile ok

Best Regards, Dharmin
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic