« 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

The comments to this entry are closed.