Example #1
0
 /**
  * Returns the runtime class of an object. That <tt>Class</tt> object is the object that is locked
  * by <tt>static synchronized</tt> methods of the represented class.
  *
  * @return the object of type <code>Class</code> that represents the runtime class of the object.
  */
 public final Class getClass() {
   Klass klass = GC.getKlass(this);
   if (klass == Klass.STRING_OF_BYTES) {
     klass = Klass.STRING;
   }
   return Klass.asClass(klass);
 }
Example #2
0
 /**
  * Returns a string representation of the object. In general, the <code>toString</code> method
  * returns a string that "textually represents" this object. The result should be a concise but
  * informative representation that is easy for a person to read. It is recommended that all
  * subclasses override this method.
  *
  * <p>The <code>toString</code> method for class <code>Object</code> returns a string consisting
  * of the name of the class of which the object is an instance, the at-sign character `<code>@
  * </code>', and the unsigned hexadecimal representation of the hash code of the object. In other
  * words, this method returns a string equal to the value of:
  *
  * <blockquote>
  *
  * <pre>
  * getClass().getName() + '@' + Integer.toHexString(hashCode())
  * </pre>
  *
  * </blockquote>
  *
  * @return a string representation of the object.
  */
 public String toString() {
   return GC.getKlass(this).getName() + "@" + Integer.toHexString(hashCode());
 }