001package edu.pdx.cs410J.lang;
002
003/**
004 * This program uses Java's reflection mechanism to print the name of
005 * a given <code>Object</code>'s class.
006 */
007public class WhatAmI {
008
009  /**
010   * Prints out the name of a given <code>Object</code>'s class.
011   */
012  private static void whatAmI(Object o) {
013    Class c = o.getClass();
014    System.out.println("I (" + o + ") am a " + c.getName());
015  }
016
017  public static void main(String args[]) {
018    whatAmI("Hello");
019    whatAmI(new Integer(4));
020    whatAmI(new Double(2.7));
021    whatAmI(new Cow("Tootie"));
022  }
023
024}