Is it better to use widening vs autoboxing?
public static void main(java.lang.String[]);
Code:
0: iconst_ 5
1: istore_ 1
2: iload_ 1
3: i2l
4: invokestatic #6; //Method hello:(J)V
7: return
}
public static void main(java.lang.String[]);
Code:
0: iconst_ 5
1: istore_ 1
2: iload_ 1
3: invokestatic #6; //Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
6: invokestatic #7; //Method hello:(Ljava/lang/Integer;)V
9: return
}
Tags: java primitive autoboxing
Source: By Andy as answer to the question
This code snippet was collected from stackoverflow, and is licensed under CC BY-SA 3.0
Related code-snippets:
- How do I convert a CSV into an XML file in Java?
- Is Object Property accessible from within object method?
- What is the meaning of the type safety warning in some Java generics casts?
- What is the difference between Int and Integer in Java and C#?
- How can I add custom button in Java?
- What are the different methods to parse strings in Java?
- Is it illegal to throw a Null parameter without a NullPointerException for that parameter?
- What tools are good for code analysis?
- How do I read from a file that is actually being written to?
- Why is Java autoboxing used only for method invocations and not classes. The type has a class and an operator and the methods are autoboxed, doesn't this mean revocations of the method can be invoked?
- How can I use Java webstart multiple libraries?
- How can I access post variables using Java Servlets?
- Can I use try block around super() call?
- How can I fix the Java Time Zone?
- What is the best way to load Java files?