Click here to watch in Youtube :
https://www.youtube.com/watch?v=0zQHpWf2mJg&list=UUhwKlOVR041tngjerWxVccw
Click the below Image to Enlarge
Java Tutorial : Java Autoboxing and Unboxing |
Java Tutorial : Java Autoboxing and Unboxing |
Java Tutorial : Java Autoboxing and Unboxing |
public class AutoBoxingDemo { public static void main(String[] args) { int intValue = 50; Integer integerObj = intValue;// Boxing System.out.println(integerObj); display(intValue); //Boxing } public static void display(Integer integerObj) { System.out.println(integerObj); } } Output
50 50
UnboxingDemo.java
public class UnboxingDemo { public static void main(String[] args) { Integer integerObj = new Integer(100); int intValue = integerObj; // UnBoxing System.out.println(intValue); display(integerObj);//UnBoxing } public static void display(int intValue) { System.out.println(intValue); } }
Output
100 100
https://sites.google.com/site/javaee4321/java/AutoBoxing_UnBoxingDemo_App.zip?attredirects=0&d=1
Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava/AutoBoxing_UnBoxingDemo_App
Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/c539eeaf4c6ff331d8e2aa2333826ea70c999093/BasicJava/AutoBoxing_UnBoxingDemo_App/?at=master
See also:
No comments:
Post a Comment