JAVA · ОСНОВЫ · LESSON 04
If not.
if, else and comparison · about 15 minutes
Learning with progressRead the summary for free. To save the work, log in to the account.
Type the code yourself
Dial both paths of the program. Find a couple of brackets at each branch.
public class Main {
public static void main(String[] args) {
int points = 7;
if (points >= 5) {
System.out.println("Супер");
} else {
System.out.println("Ещё раз");
}
}
}Open the editor for class workSolve it yourself
Create int score with a value of 8. If score is at least 5, output «Сдано», otherwise «Попробуй ещё». Use if and else.
The answer is hidden. Use similar examples from the lesson notes.
Opening up your homework