Skip to content

Instantly share code, notes, and snippets.

@ayato-p
Created November 27, 2013 05:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ayato-p/7671091 to your computer and use it in GitHub Desktop.
Save ayato-p/7671091 to your computer and use it in GitHub Desktop.
public class GenericTest {
public static void main(String[] args) {
GenericTest test = new GenericTest();
System.out.println(test.join("Hello,", "world"));
System.out.println(test.join(1, 2));
System.out.println(test.join("Hello", 99999));
}
public <T> String join(T obj1, T obj2){
return obj1.toString() + obj2.toString();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment