• 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

Use Bean Questions

 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
141 Given MyBean.java
public class MyBean {
public MyBean (int x) { }
}
and test.jsp
<jsp:useBean id="my" class="test.MyBean" scope="page"/>
Which of the following statements regarding the above code is correct ?
A It will work fine
B Compiler will complain because there is no type attribute specified.
C Will fail at Runtime
D It will fail at compile time



It says answer is D, but I saw another reference that said the answer is C.

I believe the answer is D, I would think the compiler would pick it up.
 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i can see two compile time errors

first of all you MUST have

package declared in .java file
if that's declared then

second,
you must have a public non-arg constructor as constructor is defined with argument compiler won't generate non-arg constructor for you.
 
You save more money with a clothesline than dozens of light bulb purchases. Tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic