/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;
import java.lang.reflect.*;

public class Main {
	
	private static void doit(Object x, String name) {
		System.out.println("Processing " + name);
		Type[] ifs = x.getClass().getGenericInterfaces();
		System.out.println(ifs.length);
		for (Type c : ifs) {
			System.out.println(c);
			Type[] tps = ((ParameterizedType)c).getActualTypeArguments();
			for (Object tp : tps) {
				System.out.println("===="+tp);
			}
		}
	}
	
	public static void main (String[] args) throws java.lang.Exception
	{
		
		MyInterface<? extends Number> x = new DoubleImpl();
		MyInterface<? extends Number> y = new IntImpl();
		MyInterface<? extends Number> z = new FloatImpl();
		doit(x, "double");
		doit(y, "int");
		doit(z, "float");
	}
}

interface MyInterface<T extends Number> {
	T getVal();
}

class DoubleImpl implements MyInterface<Double> {
	public Double getVal() {return 42.42; }
}
class IntImpl implements MyInterface<Integer> {
	public Integer getVal() {return 42; }
}
class FloatImpl implements MyInterface<Float> {
	public Float getVal() {return 42.24F; }
}
