class X { void f(Class aClass) throws ClassNotFoundException { Class classOfString = aClass.cast(Long.class); System.out.println(classOfString); } }