Created
March 25, 2023 18:43
-
-
Save Rohit-554/3ed5c74b829f4a41d68b539f2cac3fc5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class GenricMethod { | |
| public void printList(String []s){ | |
| for(int i=0;i<s.length;i++){ | |
| System.out.println(s[i]); | |
| } | |
| } | |
| public <T> void printlist(T []s){ | |
| for( T x :s){ | |
| System.out.println(x); | |
| } | |
| } | |
| public static void main(String[] args) { | |
| GenricMethod ob1 = new GenricMethod(); | |
| String s[] = new String[]{"This","Is","Something"}; | |
| ob1.printList(s); | |
| // Integer a[] = new Integer[]{1,2,3}; | |
| // ob1.printlist(a); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment