Convert class to string

ReturnMethodSummary
StringtoString()Converts the object to a string.

public class Main {

  public static void main(String[] args) {

    
    Class c = new String().getClass();
    System.out.println(c.getName());
    System.out.println(c.toString());
    
  }
}

The output:


java.lang.String
class java.lang.String
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.