Be aware while using single code(‘)

Hello all of us know that single code(‘) is used when we have to work  with character for  example like print it on console but have you ever tried to concat two chars with plus(+)

System.out.println(‘H’);
System.out.println(‘a’);

when we will test it there will be desired output

H
a

but what happen when we concat this two character using + sign
System.out.print(‘H’+ ‘a’);

The output is below
169

So be aware while using character 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s