• Post Reply Bookmark Topic Watch Topic
  • New Topic

boolean returns1  RSS feed

 
Giovanni Montano
Ranch Hand
Posts: 422
7
Android Open BSD Slackware
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

HI, on a tutorial i have this method create that should return a boolean (so a true/false) that returns a 1? which core concept I am missing?
I saw in the BeanPropertySqlParameterSource documentation four update methods but they have an int type not boolean



in the case
 
Henry Wong
author
Sheriff
Posts: 23283
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Giovanni Montano wrote:
HI, on a tutorial i have this method create that should return a boolean (so a true/false) that returns a 1? which core concept I am missing?
I saw in the BeanPropertySqlParameterSource documentation four update methods but they have an int type not boolean


If you look (all the way) on the right side of the return expression, you will see that the update() method return value is compared to a value of one. This is done via the "==" operator. The result of this comparison is, of course, yields a boolean value.

Henry
 
Manoj Kumar Jain
Ranch Hand
Posts: 198
Java Linux Oracle
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Look carefully, the method is not returning 1, Its comparing the result of jdbc.update method with 1.
If both are equal it will return true else it will return false.
 
Giovanni Montano
Ranch Hand
Posts: 422
7
Android Open BSD Slackware
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Henry Wong wrote:

If you look (all the way) on the right side of the return expression, you will see that the update() method return value is compared to a value of one. This is done via the "==" operator. The result of this comparison is, of course, yields a boolean value.

Henry

D'OH! of course! Now make perfect sense thank you also to Manoj
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!