diff --git a/Screenshots/program8C.png b/Screenshots/program8C.png new file mode 100644 index 0000000..7db4a92 Binary files /dev/null and b/Screenshots/program8C.png differ diff --git a/methodp1.java b/methodp1.java new file mode 100644 index 0000000..0a1ebf5 --- /dev/null +++ b/methodp1.java @@ -0,0 +1,15 @@ +// 8C +public class methodp1{ + public static > T findMax(T x, T y){ + return x.compareTo(y) > 0 ? x : y; + } + public static void main(String[] args){ + Integer maxInt = findMax(5, 10); + System.out.println("Maximum of 5 and 10 is: " + maxInt); + Double maxDouble = findMax(3.5, 7.8); + System.out.println("Maximum of 3.5 and 7.8 is: " + maxDouble); + String maxString = findMax("apple", "banana"); + System.out.println("Maximum of apple and banana is: " + maxString); + } + +}