0
Can anybody solve this small. Problem
class MyClass { public static void main(String[ ] args) { int x=7; if ( x < 57) { { System.out.println("work for money"); }else{ System.out.println("Ready to retire"); } }else{ if( x < 18 ) {System.out.println("Study hard and be at the top"); } } } }
3 Antworten
+ 1
You can't have two else statements with just one if statement
Secondly, remove 1 opening curly brace after the if statement
0
but how can I add this one statement in one program
0
in the first "else" ,change it to
else if(condition){
System.out.println(" Retire");
}