aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes help,help,help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "help,help,help" Watch "help,help,help" New topic
Author

help,help,help

feng lee
Ranch Hand

Joined: Oct 29, 2002
Posts: 33
"unary + has no effect on the value of its operand,byt the expression is promoted to at least int."-----from Complete Java2 Certification
Study Guide.That means -1 will be promoted at least int type.so "byte i=-1;"will results in compile error.But when I comile it,it runs well.Why?
Keen Chen
Ranch Hand

Joined: Nov 12, 2002
Posts: 47
because -1 is a literal,
not a var

if RHS is a compile-time constant, and in the range of the LHS, the assignment is accepted by jvm


SCJP 1.4 100% @ Peking, China <br />~~~~~~~~~~~~~~~~~~~~~<br />但使龙城飞将在, 不教胡马度阴山!
 
 
subject: help,help,help
 
Similar Threads
javacaps mock 2 Q:25
Binary Numbers Promotion, Please Clarify
Tell me Why ?
Arithmetic promotion
Arithmetic operators