+ 1
desired result not obtained after running code
Public class myclass { public static void main(String[] args) { int age = 101; if(age > 0) { if(age > 16) { if(age < 60) {if (age<100) { System.out.println("Welcome!"); } else { System.out.println("too old");}} else { System.out.println("old"); }} else { System.out.println("Too Young"); } } else { System.out.println("Error"); } } } here as the age + 101 and greater than 100, I think the result should be "too old" but what I am getting is "old".Can anyone explain me why this happens
2 ответов
0
because it is not satisfying the 3rd condition,,,
it is age<60..false...then it will go to else part
0
Its not satisfying the third and fourth condition so it will move to the else part but in the else part why it is giving output as "old" instead of "too old"?