View RSS Feed

fatabass

Casting with Class: Class.

Rating: 1 votes, 1.00 average.
by , 01-28-2012 at 08:21 PM (786 Views)
Java Code:
public class ClassCasts 
{
	
	public static void main(String args[])
	{
		Building b = new House();
		Class<House> houseType = House.class;
		House h = houseType.cast(b);
		System.out.println(b.getClass());
	}

}

Submit "Casting with Class: Class." to Facebook Submit "Casting with Class: Class." to Digg Submit "Casting with Class: Class." to del.icio.us Submit "Casting with Class: Class." to StumbleUpon Submit "Casting with Class: Class." to Google

Tags: None Add / Edit Tags
Categories
Uncategorized

Comments