GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — JavaGeneric/Example.java at main · AvinandanBose/JavaGeneric Expand file tree/ Copy pathExample.javaMore file actions 39 lines (31 loc) · 959 Bytes / Copy pathExample.javaFile metadata and controls39 lines (31 loc) · 959 Bytes 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 class Example<T > { T ob; T vals[]; Example(T o, T[] nums) { ob = o; vals = nums; System.out.println("o = " + o); for (T x : nums) { System.out.print(x + " "); } for (int i=0; i<nums.length; i++){ System.out.print("nums=" + nums[i] + " "); } } public void print(){ System.out.println("Example"); } public static void main(String[]args){ Integer n[] = {1,2,3,4,5}; String s[] = {"one", "two", "three", "four", "five"}; Double d[] = {1.1, 2.2, 3.3, 4.4, 5.5}; Example<Integer> iob = new Example<Integer>(50, n); Example<?>[] e = new Example<?>[10]; e[0] = new Example<String>("50", s); e[1] = new Example<Integer>(50, n); e[2] = new Example<Double>(50.99, d); e[0].print(); e[1].print(); e[2].print(); } } |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |