Java Programming - Language Fundamentals - Discussion
Discussion Forum : Language Fundamentals - General Questions (Q.No. 14)
14.
What is the numerical range of a char?
Answer: Option
Explanation:
A char is really a 16-bit integer behind the scenes, so it supports 216 (from 0 to 65535) values.
Discussion:
19 comments Page 1 of 2.
V.malarvizhi said:
2 decades ago
What is the numerical rang?
difference between 0 to 32767 and 0 to 65535
difference between 0 to 32767 and 0 to 65535
EswarReddy said:
1 decade ago
This is good for java students.
ArJun said:
1 decade ago
Thanks to INDIABIX
Lavanya said:
1 decade ago
What's the difference between 0 to 32767 and 0 to 65535?
Prathyusha said:
1 decade ago
In C as it occupies 1 byte its range is -128 to 127 but in Java char occupies 2 bytes so its range is 0 to 65535.
Divya said:
1 decade ago
Why is the answer not option B?
The range is determines by -2^n to 2^n-1.
Option B includes the -ve range & D doesn't.
Both are correct according to me.
The range is determines by -2^n to 2^n-1.
Option B includes the -ve range & D doesn't.
Both are correct according to me.
Debasish said:
1 decade ago
Hi Guys,
In character data type they (java creators) only considered the unsigned ( +ve) characters unlike in C like languages it was both signed and unsigned.So in C there was 2 ranges for character and integer(signed and unsigned).
In character data type they (java creators) only considered the unsigned ( +ve) characters unlike in C like languages it was both signed and unsigned.So in C there was 2 ranges for character and integer(signed and unsigned).
Arun said:
1 decade ago
In C as we can use ASCII characters and to represents all ASCII character 8bits enough hence char size is 1 byte.
In JAVA we can use UNICODE characters which cover worldwide all alphabets sets. The no of Unicode characters is >256 and 1byte is not enough so to represent all characters we have to use 2bytes.
The range for 2bytes is 0 to 65535.
In JAVA we can use UNICODE characters which cover worldwide all alphabets sets. The no of Unicode characters is >256 and 1byte is not enough so to represent all characters we have to use 2bytes.
The range for 2bytes is 0 to 65535.
Suresh said:
1 decade ago
@Arun said is correct why because java supports UNICODE characters that's why character range is 0 to 65535.
M.Srikanya said:
1 decade ago
The char data type is a single 16-bit Unicode character. It has a minimum value of '\u0000' (or 0) and a maximum value of '\uffff' (or 65,535 inclusive). So Char range is 65535.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers