What the heck is <ClassName>.class?

What the heck is <ClassName>.class?

Post by karl » Sun, 10 Aug 2003 04:16:48


I'm using Borland JBuilder at work, and its GUI building tool
generates code that looks like this:

someImageIcon = new ImageIcon(MyAppMainFrame.class.getResource("Thing.PNG"));

I can replace "MyAppMainFrame.class" with "getClass()", and achieve
the same result, like so:

someImageIcon = new ImageIcon(getClass().getResource("Thing.PNG"));

This is how I would have written this line if I had done it by hand,
because I am not familiar with the .class construct. What exactly is
it? From the above usage it looks like a static field of the enclosing
class, which would mean that these other forms:

someImageIcon = new ImageIcon(this.class.getResource("Thing.PNG"));
someImageIcon = new ImageIcon(class.getResource("Thing.PNG"));

should also work, but both yield compiler errors. It's not documented
in the API, as far as I've been able to determine. Can someone explain
to me what this .class thing is, or at least point me to where it's
documented? Obviously, this isn't critical, it's just bugging me. :-)
 
 
 

1. <bam><bam><bam><bam><bam>

2. <colgroup><col class="behold"></colgroup>

The only browser I have encountered that supports
<colgroup><col class="behold"></colgroup>
to apply a CSS style to a whole column, is Microsoft Internet
Explorer. I have been told it SHOULD NOT do so, since this is not
part of the specification.

How then to you apply styles to entire columns? Surely you don't have
to write

<td class="behold"> on every row item.

--

Roedy Green Canadian Mind Products
The Java Glossary
http://www.yqcomputer.com/

3. Casting List<> of derived class to List<> of base class?

4. RSS feed <> sql server <> aspx <> xml <> blog

5. <>*<> AI Science & Music & Meditation <>*<>

6. Creating PDF files on the 3000 <<PLUG>> <<PLUG>>

7. use case <<include>> vs. <<generalize>>

8. Mailmerge: <<First Record>> in stead of <<Next Record>>

9. > > > > USER FRIENDLY NAVIGATION BUTTON BAR < < < <

10. <newsgroup><p20><installationoofccc><sh0092>

11. CSS with <INPUT><LABEL></LABEL></INPUT>

12. <<Plug>> BridgeWare now supports Eloquence <<Plug>>

13. "<<previous<< 2 3 4 5 >>next>>" scheme

14. >><>Services<><<

15. IIS 6 <domain>\<user> vs <user>@<domain>