I was going through Java questions,and then I found this one. I am unable to understand why for this code-
public class File
{
public static void main(String[] args)
{
System.out.println('H'+'I');
}
}
Output is 145 and for this code-
public class File
{
public static void main(String[] args)
{
System.out.print('H');
System.out.print('I');
}
}
Output is HI.
In the first case,I know the output is the addition of the ASCII values of 'H' and 'I' but for second case it is not displaying ASCII values,why so? Thanks!!