0 votes
158 views
in JAVA by (98.9k points)
edited

What will be the output of the following Java program?

  1.     class leftshift_operator 
  2.     {
  3.         public static void main(String args[]) 
  4.         {        
  5.              byte x = 64;
  6.              int i;
  7.              byte y; 
  8.              i = x << 2;
  9.              y = (byte) (x << 2)
  10.              System.out.print(i + " " + y);
  11.         } 
  12.     }

a) 0 256
b) 0 64
c) 256 0
d) 64 0

1 Answer

0 votes
by (98.9k points)
selected by
 
Best answer
Answer: c

 

c) 256 0

Related questions

0 votes
1 answer 164 views
asked Jul 20, 2022 in JAVA by Doubtly (98.9k points)
0 votes
1 answer 105 views
asked Jul 20, 2022 in JAVA by Doubtly (98.9k points)
0 votes
0 answers 118 views
asked Aug 9, 2022 in JAVA by Doubtly (98.9k points)
0 votes
1 answer 254 views

Doubtly is an online community for engineering students, offering:

  • Free viva questions PDFs
  • Previous year question papers (PYQs)
  • Academic doubt solutions
  • Expert-guided solutions

Get the pro version for free by logging in!

5.7k questions

5.1k answers

108 comments

561 users

...