Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

valueOf()  RSS feed

 
midhuna peru
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys!
I was trying out program using valueOf() method. Here it is



Output


I don't understand why 'true' is displayed when 'tRue' is being sent as arguement. Please explain what is happening in printB method.
 
fred rosenberger
lowercase baba
Bartender
Posts: 12542
48
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
did you read the API for Boolean.valueOf(String s)? it states:

Returns a Boolean with a value represented by the specified string. The Boolean returned represents a true value if the string argument is not null and is equal, ignoring case, to the string "true".
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!