Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class A {
- public static <T> T f() {
- T t = (T) new Integer(42); // (?!) ЧТО ЧЁРТ ВОЗЬМИ ЗДЕСЬ ВООБЩЕ ПРОИСХОДИТ?!
- System.out.println(t.getClass());
- return t;
- }
- public static void main(String[] args) {
- System.out.println(A.<String>f()); // как здесь возможно исключение? ахаха, вы серьёзно?
- }
- }
- public class ru.izebit.A {
- public ru.izebit.A();
- Code:
- 0: aload_0
- 1: invokespecial #1 // Method java/lang/Object."<init>":()V
- 4: return
- public static <T> T f();
- Code:
- 0: new #2 // class java/lang/Integer
- 3: dup
- 4: bipush 42
- 6: invokespecial #3 // Method java/lang/Integer."<init>":(I)V
- 9: astore_0
- 10: getstatic #4 // Field java/lang/System.out:Ljava/io/PrintStream;
- 13: aload_0
- 14: invokevirtual #5// Method java/lang/Object.getClass:()Ljava/lang/Class;
- 17: invokevirtual #6 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
- 20: aload_0
- 21: areturn
- public static void main(java.lang.String[]);
- Code:
- 0: getstatic #4 // Field java/lang/System.out:Ljava/io/PrintStream;
- 3: invokestatic #7 // Method f:()Ljava/lang/Object;
- 6: checkcast #8 // class java/lang/String
- 9: invokevirtual #9 // Method java/io/PrintStream.println:(Ljava/lang/String;)V
- 12: return
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement