This is the mail archive of the
kawa@sources.redhat.com
mailing list for the Kawa project.
Re: A comment on Java style
Jim White wrote:
Works if a static is needed too:
final static String CLASSNAME = MyClass.class.getName();
The advantage is that the javac compiler fill in the package
name, and gives you an error if it can't find the class.
The disadvantage is that the generated bytecode is (essentially):
Class.forName("MyClass").getName()
This is slower, and takes up more space in the bytecode.
Furthermore, it causes MyClass to be initialized.
--
--Per Bothner
per@bothner.com http://www.bothner.com/per/