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
Outlook 2007 - Auto Create Distribution List
Better Search - Full-Text Indexing?
IIS 6 to IIS7
Office 2007 Excel cells appear blank
Script Conflict
symantec backup exec system recovery 8.5 hangs the server and restarts it,
Error installing Radeon 7k into HP DC5700
regular expression
Mac CSS Issue
Extremely slow performance on Web Application