• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

j2eecertificate.com test question

 
Prashanth reddy
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Assume the following class and interface, defined in different source files and same package, will the following JSP tag work?
<jsp:useBean id="mobile" scope="session" class="Device" type="Phone" />




1. public interface Device {
2. }
1. public class Phone implements Device{
2. }





1 Yes. The phone class implements correctly the Device interface.

2 No. The class attribute Device is not a superclass of the class Phone.

3 No. The attribute class and type cannot be used together.

4 Yes. The useBean Tag is implemented correctly.

5 No. An InstantiationException is thrown at compile-time.
ANSWER: 2
is that right answer...i think it is 5...anyone can clarify that
 
Prashanth reddy
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i think class attribute must be subclass of type attribute, if both type n classes r using???

Type = new class();......
 
Srivatsa Katta
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

U r right Pramod,

it gives the instantiation exception if type attribute is not the super class of class attribute.

So the correct answer is choice 5.

- Tripter
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic