Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Round-up Question #13  RSS feed

 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The answer says the appropriate code is:
byte c = (byte) a + b;
Since casting has priority over + in arithmetic operations, that code will still produce the compile error because it will only cast a to a byte. The following will work:
byte c = (byte) (a + b);
This is a great site, keep up the good work.
 
paul wheaton
Trailboss
Posts: 22521
Firefox Browser IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are correct.
I've made the changes to my local copy... George, can you make this change to your copy?
I've also changed the current game.
 
George Brown
Ranch Hand
Posts: 919
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yep, done.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!