Basic HTML version of Foils prepared May 12 1996

Foil 74 Determining and Testing Class of Object

From CRPC Lectures on Java Language Applets Graphics CRPC Annual Meeting Tutorial -- May 14,1996. by Geoffrey C. Fox


1 Suppose an object is called obj , then we get Class of obj by
2 Class itsclass = obj.getClass(); // and the name of this class by:
3 String name = itsclass.getName();
4 One can also use instanceof in following fashion
5 "foo" instanceof String // is evaluated to true but
6 mPoint pt = new mPoint(x,y);
7 pt instanceof String // is evaluated to false

in Table To:


Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Sun Dec 14 1997