This week's book giveaways are in the iOS and Features new in Java 8 forums.
We're giving away four copies each of Barcodes with iOS: Bringing together the digital and physical worlds and Core Java for the Impatient and have the authors on-line!
See this thread and this one for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes why is char doing strange things? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Barcodes with iOS this week in the iOS forum
or Core Java for the Impatient in the Java 8 forum!

JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "why is char doing strange things?" Watch "why is char doing strange things?" New topic
Author

why is char doing strange things?

Vedhas Pitkar
Ranch Hand

Joined: Jan 27, 2001
Posts: 445
Assume rest of code is correct & this is in a valid main().
char c=(char)-1;
System.out.println(c);//This prints ? (a question mark)
char d=(char)(Integer.MIN_VALUE);
System.out.println(d);//This causes the program to exit without any error or Exception .WHY??
Although this is not directly related to certification,I am plain curious.
Can anybody help?
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
What part is confusing:

------------------
Tom - SCJP --- Co-Moderator of the Programmer Certification Forums


Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
Bill Tripper
Greenhorn

Joined: May 30, 2001
Posts: 24
Originally posted by Thomas Paul:
[B]What part is confusing:

[/B]

FWIW, On my Win NT box, I get the following:
c=?
D=Process Exit...
Bill

Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
My results above were from running on a Win NT box. Curious!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: why is char doing strange things?