This site requires JavaScript, please enable it in your browser!
Greenfoot back

Report as inappropriate.

nccb
nccb presents ...

2012/9/5

String Storage

This tests/shows how to store an int in a single character of a string in the UserInfo class, to put more information into a single UserInfo record.

2060 views / 502 in the last 7 days

Tags: with-source

open in greenfoot

There is no HTML 5 translation of this scenario available.
View legacy version (requires Java plugin)

This scenarios uses Java features that are not available for use after conversion to HTML 5. Please try the legacy version, which requires the Java plugin to be installed.

SPowerSPower

2012/9/9

Is there a limit of the number you enter in a single char?
danpostdanpost

2012/9/9

A character contains two bytes (or 16 bits). Therefore the limit would be 65'535 (2^16-1). See the page on Primitive data types in the java trails at http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html
SPowerSPower

2012/9/9

@danpost That's right, forgot about that. Thanks.

Want to leave a comment? You must first log in.

Who likes this?

No votes yet.