不使用局部变量的值 [英] The value of the local variable is not used

查看:77
本文介绍了不使用局部变量的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以上所有变量的标题均带有警告.你能告诉我为什么会这样吗?

all of the variables above have the warning in the title. Could you please tell me why that is happening?

public class DataTypes {
    public static void main(String[] argv) {
        // new feature in JDK 7
        int x = 0b1010; // 12
        int y = 0b1010_1010;
        int ssn = 444_12_7691;
        long phone = 408_777_6666L;
        double num = 9_632_401_909.1_0_3;
        String twoLine = "line one\nline two";
    }
}

推荐答案

声明的变量从不使用,仅分配给它,因此会受到警告.

The variables you declared are never used, only assigned to, therefore you're being warned.

这篇关于不使用局部变量的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆