Microsoft
Software
Hardware
Network
Question : Set Java Class toString name?
Hello,
1: 2:
Class testClass = Test.class; System.out.println(testClass);
How can I change what is printed out in the second line of this code? With an object, I would just override the toString() method. But how can it be done with a class?
Thanks,
Rich
Answer : Set Java Class toString name?
you can call it toString() if you like, eg.
public static String toString(Class clazz) {
return clazz.getName();
}
System.out.println(MyUtili
ty.toStrin
g(testClas
s));
Random Solutions
IIS7 - Server.CreateObject Failed
Failed to allocate port error when configuring EM (Oracle 11g)
Task Manager and regedit 'disabled by administrator', unable to access Safe Mode, Antivirus deactivated
HTML table
Look Up in Query
AUTOCAD Bill of Materails Generation
APEX Icons
Two ISPs on the same network
Saving List in ASP.NET for use in second WCF Service
Help Please!