Implement the program that will consume 3 numbers from method arguments and it will print the print greatest out of three. In case if there are more than 1 biggest -> print any of them.(Libraries are forbidden)
public class MaxNumberPrinter {
public void printGreatest(int first, int second, int third) {
}
}
Complete the statement below so as to make it compile and print 23 (using ternary operator):
public class TernaryOperator {
public static void main(String[] args) {
int b = 16;
b = b __ 0 ? 10 : 23;
System.out.println(b);
}
}
Rewrite Greatest number printer task from module 4.1 Task # 2 using rewrite some task with ternary operator:
public class TernaryGreatestNumberPrinter {
public void printGreatest(int first, int second) {
}
}
Implement the program that will consume 2 numbers and based on their comparison will print to console which is bigger. Comparison should be implemented with ternary operator, which should be used inside of System.out.println method.(print "first", if the first is bigger and "second" in the rest cases). System.out.println should be used only 1 time
public class TernaryPrinter {
public void printWhichIsBigger(int first, int second) {
}
}
Create a variable "int result" and dependent on the result comparison of 2 variables from method arguments and the assign to the created variable the value using ternary result: if the first is bigger -> 10 otherwise -10. And print result variable.
public class TernaryAssignment {
public void assignAndPrintBasedOnWhichBigger(int first, int second) {
}
}
Rewrite "1. Greatest from 3." from this task using ternary operator
public class TernaryMaxNumberPrinter {
public void printGreatest(int first, int second, int third) {
}
}