Matt Gerrans
Posts: 1153
Nickname: matt
Registered: Feb, 2002
|
|
Re: variables
|
Posted: Dec 30, 2002 1:57 PM
|
|
> how many bytes a string can hold?
Strings don't hold bytes, they hold characters.
I think the limit probably larger than the amount of memory you have, but may also be arbitrarily limited by a particular JVM implementation. The impirical limit based on what we can see of the interface would be 2^64 bytes (2^63 because length() returns an int and multiply by another two because a character is two bytes).
> a boolean variable can hold only 1 byte?
No, it can only hold 1/8 of a byte. How many bits (or bytes) the JVM uses to store one boolean is different question.
> what is the range of values a variable declared as char > can take?
From Character.MIN_VALUE to Character.MAX_VALUE.
|
|