renamed 7 to 8A and 8B and 8C added as well

This commit is contained in:
Aditya Tiwari
2026-01-29 15:15:57 +05:30
parent 44740c1b22
commit ae0a8eea5f
8 changed files with 32 additions and 0 deletions

16
GenericMethod8C.java Normal file
View File

@@ -0,0 +1,16 @@
public class GenericMethod8C {
public static <A extends Comparable <A>> A findMax(A x, A 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(6.7, 9.8);
System.out.println("Maximum of 6.7 and 9.8 is: " + maxDouble);
String maxString = findMax("pineapple", "appleeeeeeeeee");
System.out.println("Maximum of 'pineapple' and 'apple' is: " + maxString);
}
}