« Look Ma! Null Reference But No NullPointerException? | Main



Feed You can follow this conversation by subscribing to the comment feed for this post.

Sai Matam


Since it is a simple program - all it takes is to save the given code into a .java file, compile and run :-) I thought it would be fun and instructive to actually run the code and experiment more.

--Sai Matam.


The answer is actually #3. You should have done a quick test before answering. And Java supports Unicode, not ASCII. It so happens J = 74 in both standards.

Sai Matam


You are right. There is a difference in using "J" (a String) and 'J' ( a char). When I first encountered this, I was very surprised. I thought I would share with everyone.

Sai Matam


You also get a different answer when using "J" versus 'J'.

However, in php you get the same answer regardless of "J" or 'J'.


Ans should be 4th option

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Your comment could not be posted. Error type:
Your comment has been posted. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.


Post a comment

Your Information

(Name and email address are required. Email address will not be displayed with the comment.)