java新人求解决"variable season might not have been initialized"
来源:学生作业帮 编辑:神马作文网作业帮 分类:综合作业 时间:2024/11/12 07:03:38
java新人求解决"variable season might not have been initialized"
public class Ifscore{
\x05public static void main(String args[]){
\x05\x05int month = 7;
\x05\x05String season;
\x05\x05switch (month){
\x05\x05 case 3:
\x05\x05 case 4:
\x05\x05 case 5:
\x05\x05 season = "Spring";
\x05\x05\x05break;
\x05\x05 case 6:
\x05 case 7:
\x05\x05 case 8:
\x05\x05\x05season = "Summer";
\x05\x05\x05break;
\x05\x05 case 9:
\x05\x05 case 10:
\x05 case 11:
\x05\x05\x05season = "Autumn";
\x05\x05\x05break;
\x05\x05 case 12:
\x05\x05 case 1:
\x05\x05 case 2:
\x05\x05\x05break;
\x05\x05default:
\x05\x05 season = "Bogus Month";
\x05\x05}
\x05\x05System.out.println("July is in the " + season+".");
\x05}
}
public class Ifscore{
\x05public static void main(String args[]){
\x05\x05int month = 7;
\x05\x05String season;
\x05\x05switch (month){
\x05\x05 case 3:
\x05\x05 case 4:
\x05\x05 case 5:
\x05\x05 season = "Spring";
\x05\x05\x05break;
\x05\x05 case 6:
\x05 case 7:
\x05\x05 case 8:
\x05\x05\x05season = "Summer";
\x05\x05\x05break;
\x05\x05 case 9:
\x05\x05 case 10:
\x05 case 11:
\x05\x05\x05season = "Autumn";
\x05\x05\x05break;
\x05\x05 case 12:
\x05\x05 case 1:
\x05\x05 case 2:
\x05\x05\x05break;
\x05\x05default:
\x05\x05 season = "Bogus Month";
\x05\x05}
\x05\x05System.out.println("July is in the " + season+".");
\x05}
}
变量season没有被初始化,将
String season;
改为
String season=null;
或
String season="";
就可以了.
String season;
改为
String season=null;
或
String season="";
就可以了.
java新人求解决"variable season might not have been initialized"
variable con might not have been initialized
delphi 提示variable "form2"might not have been initialized.
local variable 'n' used without having been initialized
local variable 'S' used without having been initialized
local variable 'x' used without having been initialized是什么意思
local variable 'd' used without having been initialized是什么意思
java.lang.IllegalStateException: BeanFactory not initialized
Hardware changes might not have been detected
eclipse中,“The local variable XXX may not have been initializ
英语翻译I might have been skeptical had I not been used to respo
not initialized是什么意思