Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Mock exam question - overriding the service() method

 
Kirstin Schapitz
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I'm currently preparing for the SCWCD certification and use the Whizlabs software for preparation.

I have a question to one of the questions from the software.
The question is:

The ProcessServlet implements service(), doGet(), and doPost() methods and is mapped to the URL http://server/shopping/ProcessServlet. Which method is invoked when a user enters the above URL in the browser's address bar? Select one choice.

A) doPost()
B) doGet()
C) Depends on the browser vendor
D) Cannot be determined based on the given information

I have selected answer D, but the software tells me that B is correct.
I thought answer D is correct, because the service() method could also be overridden to always call doPost() or not?

Thanks.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
because the service() method could also be overridden to always call doPost() or not?

You're probably thinking too much , but it's true that it could have been anything depending on how service() was implemented.
 
Somesh Rathi
Ranch Hand
Posts: 31
Eclipse IDE Hibernate Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
If no method is specified , default implementation of service() will internally call the doGet() method. Hence B is correct.
 
Ankit Garg
Sheriff
Posts: 9579
33
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The question clearly states that

The ProcessServlet implements service(), doGet(), and doPost()


So it depends on the service method implementation that doGet will be called or not...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic