0 Replies - 662 Views - Last Post: 14 May 2018 - 06:07 AM

#1 tekblade   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 81
  • Joined: 21-December 17

Function argument and return value does look incorrect-ResponseEntity

Posted 14 May 2018 - 06:07 AM

I have such problem with ResponseEntity. The function returns such statement:

public ResponseEntity<User> .... //this is declaration of function

And function doesn't return type User instead some thing:

return new ResponseEntity<>(HttpStatus.NOT_FOUND); //This is return value of function 

Maybe there is a problem:


What this above statement does mean?

What does mean and what the difference is between:




Compare secound point with my first statement:

Another example is:
Function does begin the same as previous:

public ResponseEntity<User> saveUser(parameters)

but the return value is

 return new ResponseEntity<>(savedUser, HttpStatus.NOT_FOUND);

I can't figure it out when comparing with:

return new ResponseEntity<>(HttpStatus.NOT_FOUND);

Can it be used both with function returning ResponseEntity<User>
Maybe an author made a mistake?
This is the theory from the book. But I would be grateful for some explanation. Next I want do some my practice effort to be better.

These are detection statements does Rest statement worked properly or not

This post has been edited by tekblade: 14 May 2018 - 06:09 AM

Is This A Good Question/Topic? 0
  • +

Page 1 of 1