1 ≦ (”文字列”) ≦ 100を比べるにはどうすればいいですか??
java
1import java.util.*; 2 3 4public class Main { 5 public static void main(String[] args) { 6 7 Scanner sc = new Scanner(System.in); 8 String s = sc.next();//変換する前の値 9 //int i = Integer.parseInt(s); 10 if(1 <= s && s <= 100){ //入力は1~100まで 11 //String ss = Integer.toString(s); 12 s.replace("A","4"); 13 s.replace("E","3"); 14 s.replace("G","6"); 15 s.replace("I","1"); 16 s.replace("O","0"); 17 s.replace("S","5"); 18 s.replace("Z","2"); 19 20 System.out.println(s); 21 } 22 } 23}
Error Massage
java
1Main.java:12: error: bad operand types for binary operator '<=' 2 if(1 <= s && s <= 100){ //入力は1~100まで 3 ^ 4 first type: int 5 second type: String 6Main.java:12: error: bad operand types for binary operator '<=' 7 if(1 <= s && s <= 100){ //入力は1~100まで 8 ^ 9 first type: String 10 second type: int 112 errors
回答2件
あなたの回答
tips
プレビュー