Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Possible mistake - Number Promotion - page 55

 
Mihai Botofei
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you verify this : at "Numeric Promotion Rules" , rule number 1 - shouldn't it be "If two values have SAME data types" , instead of DIFFERENT ? Because different data types case is treated in the second rule.
 
Henry Wong
author
Marshal
Pie
Posts: 22119
88
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

It would help a bit, if you told us which book you are using.

Henry
 
Narayana Bojja
Ranch Hand
Posts: 135
4
Hibernate Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Mihai,

Warm welcome to coderanch  .
I am assuming you are talking about OCAJP8 by sybex. I don't think it as a mistake. Because They are 4 rules mentioned in the book.  Rule1 is correct . I will give you example about Rule 1. For example you have int value, long value. When you are adding them, Int value will be promoted to long type then addition will be performed. That is what Rule 1 is saying.

Hope this helps !
 
Mihai Botofei
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Narayana,

I thought that DIFFERENT means integer and floating point. And this case was treated by Rule no.2. And what I meant with SAME : that they are both integer or both floating point.

Thank you for your answer !

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic