Article View: borland.public.jbuilder.java.language
Article #14981Re: Class.class <> Object.getClass() <> AClass.class
From: Christophe
Date: Thu, 22 Jul 1999 00:00
Date: Thu, 22 Jul 1999 00:00
14 lines
1058 bytes
1058 bytes
Hi
a) I haven't found info about this field in JDK 1.2 help and I can't compile
such code :
Object myObject=new Object();
String name = myObject.class.getName();
Are you sure it works ?
b) If you know the class name you can use Class.forName(String className) :
which return a class object.
Example : if you want to get an applet class object use :
Class cls=Class.forName("java.applet.Applet");
Hope this help.
Technical Details
Message-ID:
<7n6m5b$lsh13@forums.borland.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<7n6g9c$ls06@forums.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,3aab8f0f399fbb90 X-Google-Attributes: gidf74b3,public From: "Christophe" <cespern@ragemail.com> Subject: Re: Class.class <> Object.getClass() <> AClass.class Date: 1999/07/22 Message-ID: <7n6m5b$lsh13@forums.borland.com> X-Deja-AN: 503937827 Content-Transfer-Encoding: 7bit References: <7n6g9c$ls06@forums.borland.com> Content-Type: text/plain; charset="iso-8859-1" X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3 Organization: Another Netscape Collabra Server User Mime-Version: 1.0 Newsgroups: borland.public.jbuilder.java.language