?
Solved

casting and autoboxing differences and similarities in java

Posted on 2014-11-12
2
Medium Priority
?
483 Views
Last Modified: 2014-11-14
hi,

I would like to know "casting and autoboxing differences and similarities in java". When to use which one with practical examples. Thanks in advance.
0
Comment
Question by:gudii9
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 35

Accepted Solution

by:
girionis earned 1000 total points
ID: 40439387
Casting is when you convert an object type to another object type. For example you convert an "Integer" to a "Number".

Autoboxing is when you convert a primitive to an object. For example you convert an "int" to an "Integer".
0
 
LVL 20

Assisted Solution

by:Sathish David Kumar N
Sathish David  Kumar N earned 1000 total points
ID: 40439468
Boxing is when you convert a primitive type to a reference type,
(only between primitive type and wraaper classes )



Casting is when you want one type to be treated as another type (its may be a your own class _)
0

Featured Post

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The purpose of this article is to demonstrate how we can use conditional statements using Python.
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
Suggested Courses
Course of the Month9 days, 3 hours left to enroll

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question