03.hello world java

hello world java

public class hello{
    public static void main(String[] args){
    System.out.println("heelo word");
    }
}

数据类型

强类型语言:先定义,后使用

八大基本类型

int byte short long
float double
char 
boolean

强制转换

(int)c1

变量作用域

类变量

实例变量

public class Demo1 {
    //类变量  final常量
    static final double salary = 2500;

    //实例变量
    int age;

    //main方法
    public static void main(String[] args) {
        Demo1 demo01 = new Demo1();
        System.out.println(demo01.age);//实例变量
        System.out.println(salary);// 静态变量   静态方法中不能使用非静态变量
    }

命名规范

类成员变量:首字母小写,后面字母大写

类名:首字母大写,驼峰

方法名,首字母小写,驼峰

包机制

一般用公司名字域倒置

posted @ 2024-11-29 10:38  cookiesDing  阅读(16)  评论(0)    收藏  举报