public class java
{
static lang lang = new lang();
static class lang
{
static Long Short = new Long();
static class Short
{
}
static class Long
extends Short
{
}
}
public static void main(String[] args) {
System.out.println(java.lang.Short.class.getSimpleName());
}
}
2 comments:
is that so puzzling ?
if you change it to
public static void main(String[] args) {
System.out.println(java.lang.Short.getClass().getSimpleName());
}
then you get "Long".
The puzzling part is, of course, that the .class operator resolves java.lang.Short as the class, not the field.
Post a Comment