Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4558837

EOU: Please document the literal "class" in java.lang.Class

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 1.4.1
    • 1.4.0
    • docs
    • beta
    • generic
    • generic



      Name: rmT116609 Date: 12/07/2001


      java version "1.4.0-beta3"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta3-b84)
      Java HotSpot(TM) Client VM (build 1.4.0-beta3-b84, mixed mode)

      Frequently in Java newsgroups, people ask how to get the Class object associated
      with the current class. There is an easy solution which is totally undocument in the
       API documentation. In the class Class, where you talk about getName(), also
      include a reference to Foo.class as the Class object, e.g.
      public class Foo {
           static public void main(String args[]) {
                System.out.println(Foo.class.getName());
           }
      }
      Newsgroup replies sometimes suggest using forName, which is so much slower.
      Searches on java.sun.com do not easily turn this up. Add it to FAQs. Document
      it. This is so easy to fix.


      (Review ID: 136928)
      ======================================================================

            shommel Scott Hommel (Inactive)
            rmandalasunw Ranjith Mandala (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: