java.lang.Class.toString()


java.lang.Class.toString()

package com.codingdict;



import java.lang.*;



public class ClassDemo {



   public static void main(String[] args) {



      ClassDemo c = new ClassDemo();

      Class cls = c.getClass();



      // returns the string representation of this class object

      String str = cls.toString();

      System.out.println("Class = " + str);



      // returns the name of the class

      str = cls.getName();

      System.out.println("Class = " + str);

   }

}