• 类名规范:首字母大写,后面每个首字母大写(大驼峰) HelloWorld
    • 变量名规范:首字母小写,后面每个单词首字母大写(小驼峰)helloWorld
    • 方法名规范:同变量名 helloWorld


    1. public class HelloWorld { // 类名 HelloWorld
    2. public static void main(String[] args) {
    3. int numOne=5; // 变量名 numOne
    4. System.out.println(numOne);
    5. methodOne();
    6. }
    7. public static void methodOne(){ // 方法名 methodOne
    8. int numTwo=10;
    9. System.out.println(numTwo);
    10. }
    11. }