FileDocCategorySizeDatePackage
ClassKeyword.javaAPI DocExample978Sun Feb 08 21:33:52 GMT 2004None

ClassKeyword

public class ClassKeyword extends Object
Show the class keyword and getClass() method in action. The class keyword can be applied to any type known at compile time.
author
Ian F. Darwin, http://www.darwinsys.com/
version
$Id: ClassKeyword.java,v 1.4 2004/02/09 03:33:51 ian Exp $

Fields Summary
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] argv)

		//+
		System.out.println("Trying the ClassName.class keyword:");
		System.out.println("Object class: " + Object.class);
		System.out.println("String class: " + String.class);
		System.out.println("String[] class: " + String[].class);
		System.out.println("Calendar class: " + Calendar.class);
		System.out.println("Current class: " + ClassKeyword.class);
		System.out.println("Class for int: " + int.class);
		System.out.println();

		System.out.println("Trying the instance.getClass() method:");
		System.out.println("Sir Robin the Brave".getClass());
		System.out.println(Calendar.getInstance().getClass());
		//-