I once decided to add two chars together, and it gave me a number. Here's the code:
class Main {
public static void main(String[] args) {
System.out.println('a'+'b');
}
}
Output: 195
.
I've searched in a lot of places, but I still couldn't figure out why a char + char = int
. Can someone explain this to me?
NOTE: THIS IS NOT A DUPLICATE!! The other question is asking the data type of an added char. This question asks why this happens. Those are DIFFERENT QUESTIONS WITH DIFFERENT ANSWERS!