(七)java转译字符与连接字符串

  • 转义字符:通过“\”来改变后面字符的意义
    • \n空格
    • \t相当于table键
    • \b相当于回退
class Zyzf
{
    public static void main(String[] args)
    {
        System.out.println("\"hello\" \"world\"");//使后面的字符意义改变
        System.out.println("hello \n world");//代表换行
        System.out.println("hello \t world");//代表一个table键
        System.out.println("hello \b world");//代表回退
    }
}

  

  • 连接符号 +
class Ljzf
{
    public static void main(String[] args)
    {
          int num1 = 23;
          byte num2 = 67;
          System.out.println(""+"num1:"+num1+"num2:"+num2);
    }
}

  

猜你喜欢

转载自www.cnblogs.com/bgwhite/p/9299074.html