Skip to content

Instantly share code, notes, and snippets.

@jackblack369
Created February 26, 2019 08:37
Show Gist options
  • Save jackblack369/7d070bdba137fd0cc96f65feadb264e0 to your computer and use it in GitHub Desktop.
Save jackblack369/7d070bdba137fd0cc96f65feadb264e0 to your computer and use it in GitHub Desktop.
[java snippet tip] #java #snippet
  • public class
public class Main {
 
    public static void main(String[] args) {
        System.out.println("Hello World!");
    }
    public class Test1 {}  //正确
}
public class Test2{}//错误
class  Test3{}//正确
 
//
//同一个java文件(就是一个后缀为java的文本)只能有一个pulic class
//如果向使用多个class 有两中办法
//        1 在你的java文件里的public class类外面写class类 前面不能加public
//        2 在你的java文件里的public class类里面写public class类作为成员
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment