GeekInterview.com
Series: Subject: Topic:
Question: 2062 of 2109

What is the range of the char type

The range of the char type is 0 to 2^16 - 1.
Asked by: Interview Candidate | Asked on: Aug 24th, 2005
Showing Answers 1 - 2 of 2 Answers
Sumit Sengar

Answered On : Aug 24th, 2005

Char is unsigned so its minimum value is 0. It can't be negative.

  
Login to rate this answer.

In java, the range of a char type is 0 to 65535 or0 to +((2^16)-1)Getting java to print out the MIN_VALUE and max value is tricky because the characters at position 0 and 65535 are unprintable.  To remedy this cast the Character to an int.System.out.println((int)Character.MIN_VALUE);System.out.println((int)Character.MAX_VALUE);//0//65535

  
Login to rate this answer.

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

Related Open Questions

Ads

Connect

twitter fb Linkedin GPlus RSS

Ads

Interview Question

 Ask Interview Question?

 

Latest Questions

Interview & Career Tips

Get invaluable Interview and Career Tips delivered directly to your inbox. Get your news alert set up today, Once you confirm your Email subscription, you will be able to download Job Inteview Questions Ebook . Please contact me if you there is any issue with the download.