Good News Students! Become a Spellogram Contributor and Earn Money.Click Here To Know More!

Easy Way To Memorize The Size of Java Primitive Types int, char, float, double, long, boolean

0 votes
asked May 2, 2015 by nanospeck (4,600 points)
reshown May 27, 2015 by nanospeck

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
answered May 2, 2015 by nanospeck (4,600 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.

Get ₹100 per Contribution

Submit your Mnemonics to Earn Money Instantly!

*Deadline: 15th August 2017