Is it necessary to specify "employeeId" with @PathParam("employeeId") in this case,<br /> <br /> @Path("/{employeeId}")<br /> public String employeeInfo(@PathParam("employeeId") Long employeeId){<br /> }
Javasearch.buggybread.com

Search Interview Questions


 More than 3000 questions in repository.
 There are more than 900 unanswered questions.
Click here and help us by providing the answer.
 Have a video suggestion.
Click Correct / Improve and please let us know.
Label / Company      Label / Company / Text

   



Interview Questions and Answers

 Q1. Is it necessary to specify "employeeId" with @PathParam("employeeId") in this case,

@Path("/{employeeId}")
public String employeeInfo(@PathParam("employeeId") Long employeeId){
}
Rest
Ans. No, it's optional as the name of path param required is same as method param name in this case.

Even the declaration as following should work -

@Path("/{employeeId}")
public String employeeInfo(@PathParam Long employeeId){
}

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     Web Service  Get service  Rest  path param


Related Questions

 If given a choice , which one would you prefer to send params to the Get service , path params or query param ?
 Difference between Query param and path param ?



Help us and Others Improve. Please let us know the questions asked in any of your previous interview.

Any input from you will be highly appreciated and It will unlock the application for 10 more requests.

Company Name:
Questions Asked: