This is the mail archive of the kawa@sources.redhat.com mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]