Suresh Babu Venkat

Ranch Hand
+ Follow
since Sep 15, 2009
Merit badge: grant badges
Biography
SCJP 6.0 (88%)  | SCWCD 5.0 (89%)
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Suresh Babu Venkat

I would like to thanks "Head First Servelts and Jsp " and Enthuware TEst Suite...


13 years ago

Poonam Agarwal wrote:Which of the following statements is correct?

1. GenericServlet defines but does not implement doHead() method.
2. The default implementation of HttpServlet class's doHead() method calls the doGet() method.
3. The HttpServlet class does not implement a dummy doHead() method.
4. There is no special method for HEAD request, doGet() handles HEAD requests.
5. If the servlet does not implement doHead(), doGet() will be called upon HTTP HEAD request.

The above question is from Enthuware mock and the mentioned right option is 2.

Can anybody elaborate it more OR suggest something to verify for the same.

Thanks




i am just wondering if 2 is correct, option 5 also should be correct ,but why only 2 is given as answer

or if we dont override any doXXX method and call that method,its throws a exception?

Adrian Muscalu wrote:sessionMap is not safe because objects stored into the session are not thread safe. You are not creating a new object sessionMap, you are just pointing to an existing object which is not thread safe.
theMap is not safe because multiple threads can access your servlet in the same time. If one instance modifies theMap then all other instances will be having the new changes. There are different ways to avoid this.
Regards,
Adrian
[ November 08, 2002: Message edited by: Adrian Muscalu ]




public void doPost(HttpServletRequest req, HttpServletResponse res)
{
HashMap sessionMap = (HashMap) req.getSession().getAttribute("map");
//do something
}



in the above Quote sessionMap is also a local variable right?
just that its been passed a value of session atttribute.

As java is pass by value, i think sessionMap would be not at all linked to session attribute "map" once its been assigned to sessionMap.

Can anybody clear my understanding?
Thanks everyone, i also got same doubt and abt to create a new topic and did a search before doing it and found this .. thanks
I gave SCJP last Saturday ... and i paid 150$ online through credit card which along with conversion costs me 7214/-
Thanks everyone.. i am thinking whats next.. what do you guys suggest
15 years ago

Arun Giridharan wrote:well! i failed in all the Mock exam i took about 5 exam and got 58.53% as an Average ...well i really don't know and it seems that i'm gonna leave JAVA !!! it's too hard...for non-programmer.



Hey Arun, dont worry .. i also failed in all tests with an average less than wat you said.. make sure you are confident about all the topics and give the exam..

Please see this link
15 years ago
I am coming just now from the Exam and i am happy that i passed the Exam with 88%


Actually i failed in all the Exam Lab tests including the Final Test ,But i didn't loose my confidence and mean while learnt so much from each Test,

Main Exam was so easy when compared to Exam Lab Mocks.

i got about 10 drop and down questions.

No question on Serialization.



Thanks to all raunchers for all the help you did.

Thanks to K&B

and a Special Thanks to Devaka Cooray for his Exam Lab
15 years ago
can somebody tell the reason behind this behaviour
Thanks Everyone for the help.. i am clear now

This Question is from ExamLab

How many objects are eligible for GC once it reaches line 1


I found the answer is 1

but accoring to Exam Lab is 2.

I am not able to understand how? please somebody help

Deepak Bala wrote:

Suresh Babu Venkat wrote:

Darryl Burke wrote:

Prasad Kharkar wrote:the reason is that those objects are stored in the constant pool like String objects


No. Integer caches the values from -128 to 127.



what about Longs?



What happened when your tried the same code but replaced Integer with Long ?



i have already mentioned what happened , it behaving same ...see the following quote where i have mentioned





should print not equal according to the rule which you have mentioned as this is Long.But it is returning equal.

the same code prints notequal if we give value as more than 127 .

Darryl Burke wrote:

Prasad Kharkar wrote:the reason is that those objects are stored in the constant pool like String objects


No. Integer caches the values from -128 to 127.



what about Longs?
we can give any package name.. the reverse domain name is just a convention .