FileDocCategorySizeDatePackage
InstanceOfDemo.javaAPI DocExample1697Sun Dec 14 22:47:40 GMT 2003oreilly.hcj.reflection

InstanceOfDemo

public class InstanceOfDemo extends Object
Demonstrates the use of instance comparisons.
author
Robert Simmons jr. (kraythe)
version
$Revision: 1.3 $

Fields Summary
public static final Set
OBJECT_SET
A set of demon objects.
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] args)
Demo method.

param
args Command Line arguments.

		Set objectSet = new HashSet();
		objectSet.add(new Integer(5));
		objectSet.add(new String("Hardcore Java"));
		objectSet.add(new Float(22.5f));
		objectSet.add(new JPanel());
		objectSet.add(new Character('x"));
		objectSet.add(new ArrayList());
		objectSet.add(new Double(354.5676));
		objectSet.add(null);
		OBJECT_SET = Collections.unmodifiableSet(objectSet);
	
		final Iterator iter = OBJECT_SET.iterator();
		Object obj = null;

		while (iter.hasNext()) {
			obj = iter.next();
			if (obj instanceof Number) {
				System.out.println(obj);
			}
		}