package org.lxh.demo16.generics;

class Point<T> {
private T x;
private T y;

public void setX(T x){
this.x = x;
}

public void setY(T y){
this.y = y;
}

public T getX(){
return this.x;
}

public T getY(){
return this.y;
}
}


public class GenericsDemo {

public static void main(String[] args){

//Integer Point
Point<Integer> p = new Point<Integer>();
p.setX(23);
p.setY(56);
System.out.println("my point is: (" + p.getX() + "," + p.getY() + ")");

//Bill Gates mansion
Point<String> p2 = new Point<String>();
p2.setX("47度37\'37.71\"N");
p2.setY("122度14\'33.26\"W");
System.out.println("Bill Gates mansion location at: (" + p2.getX() + "," + p2.getY() + ")");

}

}