Java入门-打印Hello,world

大家好,本期是Java入门教程之打印Hello,world!

首先,先public一个类(class),并命名为My_File

public class My_File{
    
}

注意:Java中的上大括号必须写在上一行。

然后使用main方法

public class My_File{
    public static void main(String[],args){
    
    }
}

然后使用System.out.println();方法

public class My_File{
    public static void main(String[],args){
        System.out.println("Hello,world!");
    }
}

print: 打印不换行

println: 打印换行

猜你喜欢

转载自blog.csdn.net/gxlcf_516312/article/details/126617888