R
Robert Mark Bram
Hi All!
If I have a class called Test, I can always do this to get the class's name
from a static context:
Test.class.getName()
Question 1:
I think "class" is a variable belonging to Test - but "class" doesn't appear
in the Object class.. where is it defined as a variable?
Or is it a language feature, like an operator of some kind?
Question 2:
Is there a line I could insert to reference the class's name without having
to know its name (in a static context)? For example I can do this in a
non-static context:
this.getClass().getName();
But I would like to do the same job from a static context.. the idea being
so that I can write some code that outputs a class name and 'blindly' paste
that code into several classes, without having to edit it..
Thanks for any advice!
Rob
If I have a class called Test, I can always do this to get the class's name
from a static context:
Test.class.getName()
Question 1:
I think "class" is a variable belonging to Test - but "class" doesn't appear
in the Object class.. where is it defined as a variable?
Or is it a language feature, like an operator of some kind?
Question 2:
Is there a line I could insert to reference the class's name without having
to know its name (in a static context)? For example I can do this in a
non-static context:
this.getClass().getName();
But I would like to do the same job from a static context.. the idea being
so that I can write some code that outputs a class name and 'blindly' paste
that code into several classes, without having to edit it..
Thanks for any advice!
Rob