This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I think I have to disagree. Although they both have the exact same bit-wise value in memory, there are a few subtle differences. First, 0 has an int type and (char)0 has a char type. IIRC, there are some implicit conversions made between the two, they are still not the same type. This leads the the second difference, they take different amounts of memory. I don't remember the exact numbers, but I think a char is 2 bytes whereas an int is 4 bytes. I am willing to bet that these subtle differences can cause problems if they are completely ignored. There may also be other differences that I haven't thought about at the moment. HTH Layne
Depending on your system, you may see a little box, or a blank, or maybe a ?, at the end of the second line. Not a 0 though. Remember this is "Java in General (beginner)". I think the beginner-level answer is that they're usually considered the same, but not always. The details of how and when they're different may not be beginner-level, but that doesn't mean differences don't exist. [ February 23, 2004: Message edited by: Jim Yingst ]