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
DAG & CAS array configured but it's not failover
How to find the row count in an Oracle DataReader in ASP.NET?
Audit Report Generation SharePoint Content Viewing
Windows 7 Printing
PHP/Javascript newbie - need help integrating niftycube into my site
IPSEC VPN vs SSL VPN
Globally change the Blackberry Service Display name
XP 10 inbound connection limit question
Host or domain name not found - Name service error
How to Determine what SQL Databases are Installed & Running?