Back to Code Walkthrough
Generic Identity Method
Java code walkthrough · Question 38Code
Read carefully. What does this print?1public class Main {2 public static <T> T identity(T value) {3 return value;4 }56 public static void main(String[] args) {7 String s = identity("world");8 int n = identity(7);9 System.out.println(s);10 System.out.println(n);11 }12}