aspose file tools
The moose likes Beginning Java and the fly likes Difference between casting and conversion in Java Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "Difference between casting and conversion in Java" Watch "Difference between casting and conversion in Java" New topic
Author

Difference between casting and conversion in Java

nidhivel raja
Ranch Hand

Joined: Jun 26, 2008
Posts: 36
Hi all ,
Can anyone please tell me what is the difference between Casting and Conversion in Java?Thank you in advance
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3268

I found this to be a fairly good explanation.


Cheers, Martijn - Blog,
Twitter, PCGen, Ikasan, My The Well-Grounded Java Developer book!,
My start-up.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19216

With casting, you are not modifying the object. The result of the cast is still the exact same object, just with a difference type of reference pointing to it:

With conversion, you are taking the source object and (in most cases) returning a new object based on the old one:


SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
bob david
Greenhorn

Joined: Nov 27, 2008
Posts: 4
type casting , explaining with example :

roseindia.net/java/beginners/...

type conversion :

go4expert.com/forums/showthre...


bob david123
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19216

Bob, can you please finish that second link? It doesn't point anywhere valid right now, and if I just go to the forum I have to do a search there. I might as well link to our own search.

And moving to beginners.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Difference between casting and conversion in Java
 
Similar Threads
DownCasting Generally
casting reference
difference between casting and conversion
what is the diff?
Casting & Conversion