Search the courses, subjects, tracks, games and features, or jump straight to a page.
4 cards from this section. Quick, good the night before a test.
What will the following code output?
int x = 5;
if(x > 4) {
System.out.println("Greater");
} else {
System.out.println("Smaller");
}Check the condition inside if.
Write a simple if statement to check if a number is positive.
Consider how you'd express the condition.
What type of statement is used to handle multiple specific conditions?
Consider which structure best handles multiple exact matches.
True or False: The code under 'else' executes if the 'if' condition is true.
Think about what happens when the if condition is met.
Write a Java program using if-else statements to determine if a number is prime.
Remember to loop through potential factors.
Create a switch statement that takes an input for weekend days and prints whether it's a weekday or weekend.
You will have to define specific day cases to test.
5 more questions in this section. Enroll free to practise them all.
Enroll free