0

Consider below code snippet

public class TestAsc
{
  public static void main(String args[]){
   System.out.println('a');
  }
}

Here O/P is a. Now the same code snippet with an addition as below.

public class TestAsc
{
  public static void main(String args[]){
   System.out.println('a' + 'a');
  }
}

Here o/p is 194. i.e addition of ASCII values. I knew by googling it out and from some posts in StackOverflow too that, addition of char would result in ASCII addition. But my question is why and how does it happen internally? And why isn't ASCII printed when I placed only 'a' in System.out.println!

Deca
  • 1,155
  • 1
  • 10
  • 19

0 Answers0