Generic method is a method with generic type.
using System;
class Test
{
static void print<T>(T t)
{
Console.WriteLine(t);
}
static void Main()
{
print(3);
print("java2s . com");
}
}
The output:
3
java2s . com| w_ww_.___ja__v_a_2s__.__c___om__ | Contact Us |
| Copyright 2009 - 12 Demo Source and Support. All rights reserved. |
| All other trademarks are property of their respective owners. |