File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes insertion operator 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 "insertion operator" Watch "insertion operator" New topic
Author

insertion operator

prashantK Singh
Greenhorn

Joined: Sep 11, 2006
Posts: 19
hi all
kindly somebody elaborate me the result of the program

class EBH007{
public static void main (String[] s) {
byte b = 5; System.out.println(b<<1);
}}
Keith Lynn
Ranch Hand

Joined: Feb 07, 2005
Posts: 2367
The left-shift operator will move all of the bits over by 1 position, so the result is going to be

00000000000000000000000000001010
wise owen
Ranch Hand

Joined: Feb 02, 2006
Posts: 2023
How do the '>>', '>>>', and '<<' operators work?
prashantK Singh
Greenhorn

Joined: Sep 11, 2006
Posts: 19
hello
it is showing the output as 10
and not 1010
Keith Lynn
Ranch Hand

Joined: Feb 07, 2005
Posts: 2367
The binary representation of 10 is 1010. What I showed is the bit string that is produced.
prashantK Singh
Greenhorn

Joined: Sep 11, 2006
Posts: 19
thank you Keith
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: insertion operator