Help coderanch get a
new server
by contributing to the fundraiser
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
• Campbell Ritchie
• Jeanne Boyarsky
• Ron McLeod
• Paul Clapham
• Liutauras Vilda
Sheriffs:
• paul wheaton
• Rob Spoor
• Devaka Cooray
Saloon Keepers:
• Stephan van Hulst
• Tim Holloway
• Carey Brown
• Frits Walraven
• Tim Moores
Bartenders:
• Mikalai Zaikin

# operator n assignment

Ranch Hand
Posts: 30
• Number of slices to send:
Optional 'thank-you' note:
What is the result that will be printed out
public class Test {
public static void main(String[] args)
{
int a = -8;
int b = ~ -33;
a>>>=b;
System.out.println(a);
}
}

an is -8..am wondering how to work out such questionsPlease guide on this

Ranch Hand
Posts: 411
• Number of slices to send:
Optional 'thank-you' note:
Hint:
~ is complement of the number In general
~i = - (i + 1); So, ~10 is equal to -1 * (10 + 1) = -11
Similarly ~-10 = -1 * (-10+1) = 9

Let me know if that works for you.

pravin kumar
Ranch Hand
Posts: 30
• Number of slices to send:
Optional 'thank-you' note:

Ranch Hand
Posts: 47
• Number of slices to send:
Optional 'thank-you' note:
pravin kumar
Here is a short program to explain what is happing it it helps.

The output of the code is :

-33 = 11111111111111111111111111011111
After Conversion ~-33 = 100000
- 8 = 11111111111111111111111111111000
Remember only the last 5 digits are used for -33 shift whick is 0
Results of a>>>b :=-8 >>> 0 = -8

 He's giving us the slip! Quick! Grab this tiny ad! We need your help - Coderanch server fundraiser https://coderanch.com/t/782867/Coderanch-server-fundraiser