class Task { void executeTask() { System.out.println("Task is being executed"); } } class NonNumericTypeException extends Exception { NonNumericTypeException(String msg) { super(msg); } } class SumTask extends Task { synchronized T sum(T a, T b) throws NonNumericTypeException { if (a == null || b == null) throw new NonNumericTypeException("Non-numeric type"); return (T) Double.valueOf(a.doubleValue() + b.doubleValue()); } } public class Main { public static void main(String[] args) throws NonNumericTypeException { SumTask task = new SumTask<>(); task.executeTask(); System.out.println(task.sum(3.0, 4.0)); } }