笔记3

java变量必须先赋值再使用

未赋值就使用,会出错

public class Main {
    public static void main(String[] args) {
        int x; // 定义int类型变量x,并赋予初始值100
        System.out.println(1+x); // 打印该变量的值//variable x might not have been initialized
    }
}

原文地址:https://www.cnblogs.com/minconding/p/13431038.html