Bigger or smaller
Comparing values comes in handy, so let's make sure you are up to speed!
Diese Übung ist Teil des Kurses
Introduction to Java
Anleitung zur Übung
- Save the result of "
5
is smaller than7
" to theboolean
variablefirst
. - Save the result of "
9
is greater or equal to2
" to the variablesecond
.
Interaktive Übung
Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.
class Comparisons {
public static void main(String[] args) {
// 5 is smaller than 7
boolean first = 5 ____ 7;
// 9 is greater or equal to 2
boolean second = ____ ____ ____;
System.out.println("5 is smaller than 7: " + first);
System.out.println("9 is greater or equal to 2: " + second);
}
}