Site updates
Testing New System now...

Basic types

The table below summarises the basic types that are available in Java.

Type Wrapper Data stored Min value Max value
boolean Boolean Boolean (True / False) false true
char Character Single character \u0000 \uFFFF
byte Byte Whole number -128 127
short Short Whole number -32768 32767
int Integer Whole number -2,147,483,648 2,147,483,647
long Long Whole number -9,223,372,036,854,775,808 9,223,372,036,854,775,807
float Float Real number    
double Double Real number    

Where there is a choice of types for the same sort of data, for example byte, short, and int, then you should choose the one that has the smallest maximum that won't be reached. It is a good idea to be on the safe side, and choose the larger one if there is any doubt, as it could be difficult to change the program later on.

Boolean variables can be used to store data such as whether a specific test was passed or failed.

Characters could be used to store the grade achieved: A, B, C, etc. A different type would be needed if there were + and - grades as well.

Bytes could be used to store the percentage achieved in a test, assuming only whole numbers are used.

Shorts could be used to store the number of people taking a test in a particular institution. Bytes are risky, because *some* tests may well have over 127 people sit them.

Ints could be used to store the centre number where the test was taken, for example 48269.

A Long would be needed if the entire population of the world was being modelled (and maybe being forced to take a test :)

Float could be used to calculate the average score between several tests.

Double could be used for really long sums, with lots of values being carried forward, so the detail is not lost. And you can get tested on these sums later. (Yes, some of these links are weak)

NOTE: The Java section is mostly in maintenence mode. I don't have time to work on it right now. Errors will be corrected if pointed out, but they are not actively being searched for. Newer site features, like alternate stylesheets, may cause problems with these pages.