main函数中不写public可以吗?

结果肯定是不可以的!因为JVM在运行此代码时,会找不到入口函数! 

public class Test {
	static void main(String[] args) {
		System.out.println("hehe");
	}
}

 

运行结果:

posted @ 2018-10-08 00:02  ChenPS  阅读(305)  评论(0编辑  收藏  举报