小编Ste*_*ef 的帖子

局部变量是冗余intellij

public static double getAmount(){
    Scanner reader = new Scanner(System.in);
    System.out.println("random text");
    double amount;
    return (amount = reader.nextDouble());
}
Run Code Online (Sandbox Code Playgroud)

IntelliJ在上面的代码中给出了这个警告:

局部变量'amount'是多余的

为什么?

java intellij-idea

2
推荐指数
1
解决办法
6858
查看次数

标签 统计

intellij-idea ×1

java ×1