File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "help,help,help" Watch "help,help,help" New topic


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 "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 />但使龙城飞将在, 不教胡马度阴山!
I agree. Here's the link:
subject: help,help,help
It's not a secret anymore!