The INVALID flag for a deleted record is 0X8000, which is 32768. A short in Java goes to 32767. This flag is 2 bytes in the database. Shouldn't it be a int, using 4 bytes; the compiler won't take this: private static final short INVALID = 0X8000;
Originally posted by Jim Thompson: Why isn't the flag an int instead of a short? Why 2 bytes?
Why even two bytes? It should be one byte (as it was in the database file I had for my assignment). Actually a flag can be represented in a single bit, so even a single byte is ample. I suspect they vary the size of the flag so that there are different versions of the assignment. I guess this is so one can't just take a solution to one of the assignment versions and have it work correctly with the database file from another version.