美文网首页
编写带有main()的类

编写带有main()的类

作者: HanMeng | 来源:发表于2018-02-04 14:53 被阅读0次

public class hm {

    public static void main(String[] args) {

    System.out.println("hanmeng");

    }

}

public:公开给其他类存取

class:类声明

hm:类的名称

static:静态

void:代表没有返回值

main:方法的名称

(String[] args) :必须要传String的数组给此方法当参数,命名为args

System.out.println:打印到标准输出上(默认为命令行)

("hanmeng"):要输出的字符串

;:每一行述句都必须用分号结尾

相关文章

网友评论

      本文标题:编写带有main()的类

      本文链接:https://www.haomeiwen.com/subject/fgpmzxtx.html