20130329java基础学习笔记语句_for循环嵌套练习(99乘法表&转义字符)

class ForFor99
{
    public static void main(String[] args)
    {
        /* 九九乘法表:
        1*1=1
        1*2=2 2*2=4
        1*3=1 2*3=6 3*3=9
        ......
        */
        for(int x=1; x<=9; x++)
        {
            for(int y=1; y<=x; y++)
            {
                System.out.print(y+"*"+x+"="+y*x+"\t");
            }
            System.out.println();//println中的ln是在最后位置换行;
        }
        System.out.println("\"hello\nword\"");
        /*转义字符:能转变某些字母和含义的符号称为转义字符;
        \n:回车;
        \t:制表符;(按下Tab键)
        \b:退格;
        \r:按下回车键;
        Windows系统中回车符其实是由两个符号组成的\r\n;
        Linux中回车符就是\n;
        */
    }
}

原文地址:https://www.cnblogs.com/lisu/p/2989227.html