Question

What process does the following program illustrate in java? package test; public class MyClass { public...

What process does the following program illustrate in java?

package test; public class MyClass { public static void main(String[] args) { int i = 10; Integer iObject = i; System.out.println(iObject); } }

unboxing, autoboxing, encapsulation, abstraction

0 0
Add a comment Improve this question Transcribed image text
Answer #1

The below program illustrate autoboxing in java.

Autoboxing is converting any primitive data type to its corresponding wrapper class object.

example -

int i = 5;

Integer iObject = i;

Java compiler performs autoboxing automatically in the example when int data type value was assigned to the variable of the corresponding(Integer) wrapper class.

What other terms mean -

Unboxing - it is opposite of autoboxing. here a Wrapper class object will be assigned to a corresponding primitive data type.

Encapsulation - It is the binding of data (variables ) and methods in one class. like class A { int a; int b; sum(){return a+b;} }

Abstraction - It means hiding the implementation of a method from the user.

Add a comment
Know the answer?
Add Answer to:
What process does the following program illustrate in java? package test; public class MyClass { public...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT