Priya Jaspal

+ Follow
since Jan 29, 2009
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Priya Jaspal

String a = 'a'; //1
String c = '\u0041'; //2
String e = 'abcd'; //3
String b = 'abc'; //4

When i am trying to compile the above code ,It showing error in line 3 not in line line4.

but if i replace line3 with line4 this

String a = 'a'; //1
String c = '\u0041'; //2
String b = 'abc'; //3
String e = 'abcd'; //4

Now ,also its showing error with line3.....

I am not able to understand the logic behind this.
Can somebody help me out..?

Yeah...Now I understood.

-4 will be the correct answer.

Thanks a lots!
I know that 1100 is 12 in decimal number system.
But 12 is not at all there in options.

So,Can you be more clear?

Hi Ankit,

I have done editing with my post.
Hope its fine now...If still there is any problem then please let me know.

I know this type of question will not be asked in SCJP1.5.
But i found it somewhere.
I know the answer but wondering on it.
I will be grateful if it will be answered.

What gets printed when the following program is compiled and run. Select the one correct answer and provide the clarification please...

public class test {
public static void main(String args[]) {
byte x = 3;
x = (byte)~x;

1. 3
2. 0
3. 1
4. 11
5. 252
6. 214
7. 124
8. -4

Source:This question was asked in a Java Mock test on net.