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 Marcus Q46 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 "Marcus Q46" Watch "Marcus Q46" New topic

Marcus Q46


Joined: Jun 15, 2000
Posts: 25
This is the question from marcus
Which of the following will compile without error?
String s = "Hello";
long l = 99;
double d = 1.11;
int i = 1;
int j = 0;
The answer is j = i << j and j = i << l
I understood the first answer j = i << j. But why is the answer j = i << l correct? I thought that b'coz of arithmetic promotion, i << l is promoted to long & how does it fit into j? Can anybody please help me with this?
[This message has been edited by Jim Yingst (edited July 10, 2000).]
Sandra Marti
Ranch Hand

Joined: Jun 08, 2000
Posts: 63
Your question was already discussed here
I agree. Here's the link:
subject: Marcus Q46
jQuery in Action, 3rd edition