Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

String s = "" + (int)c;

 
Karin Paola Illuminate
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

How could I know that "" + c and "" + (int)c are not the same. I mean, how do I know that (int)c will return 97, and not, for example, 96 or 98? Should I know the exact integer, or should I only know that there is a difference for the exam?
 
Leandro Oliveira
Ranch Hand
Posts: 298
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For the exam, it's not required to know that (int)c would return 97, but you should know that it would return a number and ""+c would return "c". That is what the exam requires you to know!!
 
Leandro Oliveira
Ranch Hand
Posts: 298
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ooops!!! forgive me... ""+c would return "a"
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic