class Point<T> { private T x; private T y; public T getX() { return x; } public void setX(T x) { this.x = x; } public T getY() { return y; } public void setY(T y) { this.y = y; } } public class GenericDemo { public static void main(String args[]) { Point<Float> p = new Point<Float>(); p.setX(100.1f); p.setY(325.3f); System.out.println(p.getX() + " " + p.getY()); } }