690 shaares
3 liens privés
3 liens privés
Reminder classloader, classname :
Exit0.class.getSimpleName() = Exit0
Exit0.class.getCanonicalName() = com.gorki.Exit0
<instance>.getClass().getSimpleName() =
<instance>.getClass().getCanonicalName() = null
<instance>.getClass().getName() = com.gorki.Exit0$1
<instance>.getClass().getTypeName() = com.gorki.Exit0$1
<instance>.getClass().getPackage().getName() = com.gorki
<instance>.getClass().isAnonymousClass() = true
With :
package com.gorki;
import java.util.ArrayList;
import java.util.Random;
public class Exit0 {
public static void main(String... args) {
Runnable t = new Runnable() {
@Override
public void run() {
}
};
System.out.println("Exit0.class.getSimpleName() = " + Exit0.class.getSimpleName());
System.out.println("Exit0.class.getCanonicalName() = " + Exit0.class.getCanonicalName());
System.out.println("<instance>.getClass().getSimpleName() = " + t.getClass().getSimpleName());
System.out.println("<instance>.getClass().getCanonicalName() = " + t.getClass().getCanonicalName());
System.out.println("<instance>.getClass().getName() = " + t.getClass().getName());
System.out.println("<instance>.getClass().getTypeName() = " + t.getClass().getTypeName());
System.out.println("<instance>.getClass().getPackage().getName() = " + t.getClass().getPackage().getName());
System.out.println("<instance>.getClass().isAnonymousClass() = " + t.getClass().isAnonymousClass());
}
}