how to solve
package com.codegym.task.task04.task0409;
/*
1. The program should display text on the screen.
2. The main method should not call System.out.println or System.out.print().
3. The main method should call the displayClosestToTen method.
4. The displayClosestToTen method should call the abs method.
5. The displayClosestToTen method should display a number on the screen in accordance with the task conditions.
*/
public class Solution {
public static void main(String[] args) {
displayClosestToTen(8, 11);
displayClosestToTen(7, 14);
}
public static void displayClosestToTen(int a, int b) {
// write your code here
int a1 = abs(a - 10);
int b1 = abs(b - 10);
if(a1 < b1)
{
System.out.println(b);
}
if (a1 > b1)
{
System.out.println(a);
}
}
public static int abs(int a) {
if (a < 0) {
return -a;
} else {
return a;
}
}
}