• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

JWeb+ Question

 
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
 
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
 
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
 
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.
 
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
 
Let's get him boys! We'll make him read this tiny ad!
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic