View RSS Feed

Recent Blogs Posts

  1. Different Java Generic Types

    by , 02-18-2012 at 03:35 PM
    By using Generics, implementation of Box class is done. It is shown in the given code

    Java Code:
    public class Box<T> {
    
        // T stands for "Type"
        private T t;
    
        public void add(T t) {
            this.t = t;
        }
    
        public T get() {
            return t;
        }
    }
    In given Box class replacement takes place with T, of all occurrences objects.

    For referencing ...
    Categories
    Generics