Article View: borland.public.jbuilder.java.language
Article #14976Class.class <> Object.getClass() <> AClass.class
From: Hugo Ferreira
Date: Wed, 21 Jul 1999 00:00
Date: Wed, 21 Jul 1999 00:00
38 lines
1298 bytes
1298 bytes
Hi,
I am currently working on an ORB and need to identify the class via its
name.
1. I know I can instanciate and object and obtain its class name this way
AClass instance = new AClass();
String name = instance.getClass().getName();
2. Or I know I can get a classes definition via the class attribute
String name = AClass.class.getName();
I have two questions:
a) Is accessing the "class" attribute correct. I could not get info. on this
field. Does it
belong to Object ? Where is this info. ?
b) Say I want to pass a Class object as a parameter. Is there any way I can
access this information
without instantiating an object as I did in 1. ?
ex:
class AClass
{
}
class A
{
call( Class cls ){}
}
A a = new A()
a.call( AClass ) <---
TIA.
Hugo Ferreira.
Technical Details
Message-ID:
<7n6g9c$ls06@forums.borland.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,3aab8f0f399fbb90,start X-Google-Attributes: gidf74b3,public From: "Hugo Ferreira" <HugoF@cocaina.inescn.pt> Subject: Class.class <> Object.getClass() <> AClass.class Date: 1999/07/21 Message-ID: <7n6g9c$ls06@forums.borland.com> X-Deja-AN: 503913125 Organization: Another Netscape Collabra Server User X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3612.1700 Newsgroups: borland.public.jbuilder.java.language