Why does concatenated characters print a number?

前端 未结 7 1714
离开以前
离开以前 2020-12-16 04:44

I have the following class:

   public class Go {
     public static void main(String args[]) {
      System.out.println(\"G\" + \"o\");
      System.out.prin         


        
7条回答
  •  自闭症患者
    2020-12-16 05:42

    + operator with character constant 'G' + 'o' prints addition of charCode and string concatenation operator with "G" + "o" will prints Go.

提交回复
热议问题