About Question enthuware.jwpv6.2.732 :

Moderator: admin

Post Reply
Sireesha

About Question enthuware.jwpv6.2.732 :

Post by Sireesha »

The options 4 and 5 seems to be the same. But answer picks 4 but not 5 why?

admin
Site Admin
Posts: 10036
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.jwpv6.2.732 :

Post by admin »

No, they are different. 4 is right. The reason is explained in the explanation.

HTH,
Paul.
If you like our products and services, please help us by posting your review here.

JoeAllen
Posts: 13
Joined: Thu Jul 11, 2013 11:22 pm
Contact:

Re: About Question enthuware.jwpv6.2.732 :

Post by JoeAllen »

Option 1:
<%@ page import="java.util.*" autoFlush="true"%>
<%@ page import="java.io.*" autoFlush="false"%>
Explanation: Any page directive except import can only occur only once.

So Option 1 should be correct based on the explanation, right?

admin
Site Admin
Posts: 10036
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.jwpv6.2.732 :

Post by admin »

autoFlush is occurs twice in this option.
If you like our products and services, please help us by posting your review here.

shareef.hiasat
Posts: 20
Joined: Thu Dec 19, 2013 8:22 am
Contact:

Re: About Question enthuware.jwpv6.2.732 :

Post by shareef.hiasat »

admin wrote:autoFlush is occurs twice in this option.
so if autoFlush occurs twice means its not valid and will not compile ?!

admin
Site Admin
Posts: 10036
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.jwpv6.2.732 :

Post by admin »

Yes, you cannot repeat this attribute.
If you like our products and services, please help us by posting your review here.

kunalh
Posts: 1
Joined: Sun Dec 06, 2015 12:04 am
Contact:

Re: About Question enthuware.jwpv6.2.732 :

Post by kunalh »

Can anyone please explain why option 5 is wrong? I am not able to get a clear understanding from the explanation given in the Test Studio

Thanks

admin
Site Admin
Posts: 10036
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.jwpv6.2.732 :

Post by admin »

There is ! sign in Option 5 and so it is a declaration and will be converted to something like:

Code: Select all

public class test$jsp extends HttpServlet
{
  Hashtable ht = new Hashtable();
  
  ht.put("max", "10"); //1  This line is not ok.
  ....
  public void _jspService(...){ ... }
}
[code]

As you can see Line marked //1 is not valid java code.

HTH,
Paul.
If you like our products and services, please help us by posting your review here.

johnlong
Posts: 197
Joined: Mon Jun 20, 2016 5:06 pm
Contact:

Re: About Question enthuware.jwpv6.2.732 :

Post by johnlong »

Any page directive except import can only occur only once.
Import may occur multiple times, the problem is with flush attribute.
Please confirm, explanation is not quite correct.

admin
Site Admin
Posts: 10036
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.jwpv6.2.732 :

Post by admin »

Why do you think the explanation is incorrect? It says that same thing you are saying i.e. import can occur multiple times.
If you like our products and services, please help us by posting your review here.

johnlong
Posts: 197
Joined: Mon Jun 20, 2016 5:06 pm
Contact:

Re: About Question enthuware.jwpv6.2.732 :

Post by johnlong »

I does not say that the problem is with flush attribute being contradictory in two imports, i.e. multiple imports are fine, unless we don't specify different flush attributes.

admin
Site Admin
Posts: 10036
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.jwpv6.2.732 :

Post by admin »

The code in the option uses autoFlush twice. And the explanation clearly says, "Any page directive except import can only occur only once."
So I am not really sure what are you confused about.
If you like our products and services, please help us by posting your review here.

johnlong
Posts: 197
Joined: Mon Jun 20, 2016 5:06 pm
Contact:

Re: About Question enthuware.jwpv6.2.732 :

Post by johnlong »

Actually import can appear multiple times, but without contradictory flush attribute.

Post Reply

Who is online

Users browsing this forum: No registered users and 15 guests