View RSS Feed

Recent Blogs Posts

  1. Generic Methods and Constructors

    by , 02-18-2012 at 04:37 PM
    Within methods declaration of the type parameters could be done and constructor signatures for creation of the generic constructors or generic methods.
    Java Code: This is the code to explain Generic Methods
    public class Box<T> {
        private T t;          
        public void add(T t) {
            this.t = t;
        public T get() {
            return t;
        public <U> void inspect(U u){
            System.out.println("T: " +