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
Create a simple movie cataqlog with XML
Visual Studio 2010 removal of Bite Order Mark VB -or PHP solution?
Error message when replying, sending, openning email in OWA
Cisco ASA 5505 connecting to Internet through a Comcast Router
Comparison Netgear ReadyNAS vs. Buffalo Terastation
Using a delegate to report back to an object
Access 2007 - Query Question
APEX Applications using SSL
Delete temporary internet files?
Enteprise Application Documentation Application