Hey guys while i'm studying about java.. i got a few Questions.. It will be very beneficial for me if you guys tell me
What's the Difference between
&& and &
|| and |
what's the use of &,|,~,^??
Why we encounter a error if we write the following code?
int a=10;
double b=10.1;
int c=(b=a)?10:20;
System.out.println(c);
How is it possible ??
byte x=2;
byte y=4;
System.out.println(x&y); // why it prints 0 ??
System.out.println(x|y); // why it prints 6 ??
System.out.println(x^y); // why it prints 6 ??
System.out.println(~x); // why It prints -3??
If so what's the value of (~-2)??
and how will SHIFT's work
<< SHIFT LEFT
>> SHIFT RIGHT
>>> UNSIGNED SHIFT RIGHT
how come these output's possible??
System.out.println(2<<1); //why it prints 4 ??
System.out.println(2<<2); //why it prints 8 ??
System.out.println(2<<5); //why it prints 64??
what does 2 and 1 represents??? i mean does the above statement says shift 2 bits to left from 1 or shift 1 bit to left from 2
If so Does that mean the numbers look like as shown below???
......9 8 7 6 5 4 3 2 1 0 -1 -2 -3 -4 -5 -6 -7 -8 -9 .....
(OR)
......-9 -8 -7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7 8 9 .....
Which is correct???
System.out.println(-1>>5); //why it prints -1 ??
System.out.println(-1>>>5); //why it prints 134217727 ??
why we lost data when we are converting from
int --> float
long --> float
long --> double
like suppose if
i=85689012
float f=i;
why f=8.5689008E7?
What does that E mean??
what's the difference between UPPER CASE and LOWER CASE in Floating point Literals??
63.5D, 4F2C, 3e-1D, 63.5d,4f2c
what does float f=2.4f21e means??
Integer Literals are by default 4 types rigt??
Decimal
Octal??
Hexa decimal
Long literals
how come 0xE ,0xe, 0x22
In Hexa Decimal there are alphabets from A to F right??
What does x means then??
What are the values of above numbers??
Can anyone explain these to me i don't understand these at all??
Bookmarks