Any one help ....Answer is correct but what is wrong ....?Why there is an error showing...?
package com.codegym.task.task04.task0409;
/*
Closest to 10
*/
public class Solution {
public static void main(String[] args) {
displayClosestToTen(8, 11);
displayClosestToTen(7, 14);
}
public static void displayClosestToTen(int a, int b) {
int A = abs(a - 10);
int B = abs(b - 10);
if (A < B) {
System.out.println(a);
} else if (B < A) {
System.out.println(b);
} else if (A == B){
System.out.println(a +" "+ b);
}
}
public static int abs(int a) {
if (a < 0) {
return -a;
} else {
return a;
}
}
}