fork download
  1. public class Main {
  2.  
  3. public static void main(String[] args) throws Exception {
  4.  
  5. new Main().ensureLessThan(15, 4);
  6.  
  7. System.out.println("done");
  8. }
  9.  
  10. <N extends Number & Comparable<N>, S extends N> S ensureLessThan(N threshold, S input) {
  11. if (input.compareTo(threshold) >= 0) {
  12. throw new IllegalArgumentException("Input " + input + " is not less than " + threshold);
  13. }
  14. return input;
  15. }
  16. }
Success #stdin #stdout 0.06s 215488KB
stdin
Standard input is empty
stdout
done