A string representation of this class object. The string representation is the string "class" or "interface", followed by a space,
and then by the fully qualified name of the class in the format returned by
getName(). If this
Class
object represents a primitive type, this method returns the name of the primitive type. If this
Class
object represents void this method returns "void".
Examples
package com.logicbig.example.clazz;
public class ToStringExample {
public static void main(String... args) { String s = String.class.toString(); System.out.println(s); } }
Output
class java.lang.String
package com.logicbig.example.clazz;
public class ToStringExample2 {
public static void main(String... args) { String s = Runnable.class.toString(); System.out.println(s);
s = Deprecated.class.toString(); System.out.println(s); } }