Search the courses, subjects, tracks, games and features, or jump straight to a page.
3 cards from this section. Quick, good the night before a test.
What will be the output if int age = 16; if (age >= 18) { System.out.println("Adult"); } else { System.out.println("Minor"); }?
Think about the value of age and its comparison.
What is the basic syntax of an if statement?
Remember the structure of an if statement.
Which of the following statements is correct about the if statement?
Consider how multiple conditions can be checked.
True or False: The switch statement requires at least one case to be defined.
Think about what happens if no cases are provided.
Write a program that determines a grade based on a score using if-else statements. The grading scale is: A (90-100), B (80-89), C (70-79), D (60-69), F (below 60).
Remember to check ranges correctly for each grade.
Create a program that uses a switch statement to display the number of days in a month. Ensure to handle February correctly for leap years.
Think about how leap years affect February's day count.
6 more questions in this section. Enroll free to practise them all.
Enroll free