Visit our Youtube channel to access new animated learning tricks Click Here.
0 votes
9.5k views
by (7.8k points)
reshown by

This is a very common question for online java exams. Can we find an easy mnemonic to memorize this size of primitives. Read a textual answer here . We need to find a shortcut to keep it in mind.

1 Answer

0 votes
by (7.8k points)

One way I found was to reorder the list into groups with same size and create a mnemonic to memorize it.

  • boolean (1 bits)
  • byte (8 bits)
  • char, short (16 bits)
  • int, float (32 bits)
  • long, double (64 bits)

Now the Spell :

1 hooligan got 8 bites and his 16 wheeled car was shot into floating waters double the size of london 64

  • hooligan : boolean
  • bites : byte
  • car - char
  • shot - short
  • double - double
  • london 64 - long

Tip : Note that that the unit is bits and each group increment the size twice its predecessor except for byte.

Related questions

0 votes
1 answer 515 views
0 votes
1 answer 2.6k views
0 votes
1 answer 3.2k views
Sharing improves retention
...