aspose file tools
The moose likes Beginning Java and the fly likes type casting a character 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 "type casting a character" Watch "type casting a character" New topic
Author

type casting a character

nirjari patel
Ranch Hand

Joined: Apr 23, 2009
Posts: 240
short is a signed integer and its values can range from -32768 to 32767.
Character is an insigned integer and values can range from 0 to 65535

If a charactet has a value of less than 32767 then it can be type casted to same value as short.
What happens if a character has vaue of more than 32767 ? If I type cast it to short, what will be the resulting value ?

Thanks
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

nirjari patel wrote:... What happens if a character has vaue of more than 32767 ? If I type cast it to short, what will be the resulting value ? ...

If only there were some way to test that...


"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
 
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: type casting a character
 
Similar Threads
doubt
Kathy Sierra - SCJP 1.6 - Chapter 3 - Self Test - question 1 - doubt
Integer Caching?
why compilation fails here
Arithmetic Promotion. What's the deal here?