小编Sul*_*ora的帖子

值未在if语句中初始化

以下代码有一个编译器错误:

speedMsg might not been initialized

我该如何解决这个问题?

String speedMsg;

// Determine the grade
if (speed >= 150)
  speedMsg = "STOP! STOP! Please let me OUT!";
else if (speed <= 150)
  speedMsg = "Whew I'll just walk from here Thanks.";
Run Code Online (Sandbox Code Playgroud)

java

0
推荐指数
1
解决办法
411
查看次数

标签 统计

java ×1