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
Automatically Adding Text to Cells
Terminal server 2008 R2 Pinned Taskbar Links
dell powervault ejection issues
OpenOffice 3.2 GPO Install Problem
click on login
Folders UNIDs and Duplicates
SBS server 2003 VPN connection
Coookie not storing information
How do I enable audio mapping over RDP on Windows 7?
System.FormatException:Dat
agridviewC
omboboxcel
l value is not valid