Win a copy of AWS Security this week in the Cloud/Virtualization forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Mock exam question - overriding the service() method

 
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.
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • 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.
 
Ranch Hand
Posts: 31
Hibernate Eclipse IDE 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.
 
Sheriff
Posts: 9671
42
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • 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...
 
Politics n. Poly "many" + ticks "blood sucking insects". Tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic