Home / Programming MCQs / JAVA MCQs / Question
R
Q. What is the output of this program?
public class Bitwise_Operator { public static void main(String args[]) { int num1 = 30; int num2 = ~num1; System.out.print(num1 + " " + num2); } }
Unary not operator, ~, inverts all of the bits of its operand. 30 in binary is 00011110 in using ~ operator on num1 and assigning it to num2 we get inverted value of 30 i:e 11100001 which is -31 in decimal. output: 30 -31
You must be Logged in to update hint/solution
What is the output of the following program ?
Which of these packages contain all the collection classes?
What is the output of the Java code snippet?
An object is created at __ time in Java.
Which of this package contains classes and interfaces for networking?
Among Relational operators and Assignment operators, which operators have higher priority?
Discusssion
Login to discuss.