|  | 
|  | 
| вернуться в форум | why doesn't it work? java Послано Argin  27 фев 2020 21:10import java.util.Scanner;public class javasucc {
 public static void main(String[] args) {
 Scanner in = new Scanner(System.in);
 int n = in.nextInt();
 int h = 2, s = 10;
 for(int i=0; i<n; i++) {
 int a = in.nextInt();
 String b = in.next();
 if(b=="hungry"){
 if(a>h) {h = a;}
 }
 else if(b=="satisfied"){
 if(a<s) {s = a;}
 }
 }
 if(h >= s) System.out.println("Inconsistent");
 else System.out.println(s);
 }
 }
 
 and the problem is that program doesn't want to do if and i can't change s to a
Re: why doesn't it work? javaRe: why doesn't it work? java Послано Argin  12 мар 2020 20:581) I wasn't crying for help though but just was wondering why2) Thanks for the link, the problem was actually in "=="
 | 
 | 
|