#java #javatutorial #javacourse
public class Main {
public static void main(String[] args) {
// ternary operator ? = Return 1 of 2 values if a condition is true
// variable = (condition) ? IfTrue : IfFalse;
int number = 10;
String evenOrOdd = (number % 2 == 0) ? "EVEN" : "ODD";
}
}
public class Main {
public static void main(String[] args) {
// ternary operator ? = Return 1 of 2 values if a condition is true
// variable = (condition) ? IfTrue : IfFalse;
int number = 10;
String evenOrOdd = (number % 2 == 0) ? "EVEN" : "ODD";
}
}
- Category
- Bro Code
- Tags
- java tutorial, java programming, java course

Be the first to comment