【问题标题】:Local variables underline when reallocating in Android Studio在 Android Studio 中重新分配时局部变量下划线
【发布时间】:2020-06-27 06:11:54
【问题描述】:

在Android Studio中重新分配局部变量时,为什么变量名下面有下划线? 我认为是因为函数式编程不建议重新分配变量。 对吗?

在 defaultDicWordDuplicationFlag 变量中创建下划线

boolean defaultDicWordDuplicationFlag = false;

for (DicWord item: outDefaultDicWords) {
    if (item.word.equals(dicword.word)) {                           
        defaultDicWordDuplicationFlag = true;
        break;
    }
}

if (defaultDicWordDuplicationFlag == true)
    continue;

【问题讨论】:

  • 具有讽刺意味的是,您问题中最糟糕的英语是"baaaaad"

标签: java android underline


【解决方案1】:

是的,这是重新分配变量的亮点。一个更喜欢不可变值的小提示。

您可以更改 Android Studio 首选项中的设置,如图所示:

【讨论】:

  • 感谢完美答案:)
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2013-11-22
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-10-24
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多