為啥不行呢?
public class HelloWorld {
??? public static void main(String[] args) {
??int one = 20 ;
??int one = 20 ;
??String=res;
???? if((one%2)==0)
???? res = "偶數(shù)";
???? else
???? res = "奇數(shù)";
???? System.out.println("res"+res);
?
???
???
???
???
?}
}
2020-05-25
我是這么寫的
public class HelloWorld {
? ? public static void main(String[] args) {
int one = 20 ;
float two = one/2;
if(two == 0){
? ? System.out.println(one+"是偶數(shù)!");
}else{
? ? System.out.println(one+"不是偶數(shù)!");
}
}
}
2020-03-26
res和one 什么關(guān)系
2019-12-02
String=res;這是定義res的語句吧中間等號去掉啊;
String res;
然后one不用賦值兩次的
2019-12-02
你可以嘗試在eclipse里運行,編譯器 會報錯?
首先one已經(jīng)作為變量,不能二次定義
另外 定義String不是這樣的
? 參考這個格式 :String 變量名=new String();