After going through the example, you will be able to declare and use generic methods in Java programming language. As you already know, generic method use parameter type declaration and that can be done using the <> syntax.
public static <E> void printArray(E inputArray). The syntax can be used only before the return type of the method. Basically generic method can be used by any generic or nongeneric class and those class can used that generic type as argument. They can also use it as return type.
Code for Java Method - Generics
Output will be displayed as:
Rs. 20,000 US$ 300
Today: Rs. 10,000 US$150
Course Duration: 30 hrs
Posted on: November 15, 2008 If you enjoyed this post then why not add us on Google+? Add us to your Circles