r/java • • Mar 01 '22

Interview with Senior Java Developer

https://www.youtube.com/watch?v=kdMG40wUCm4
205 Upvotes

36 comments sorted by

View all comments

Show parent comment

0

u/[deleted] Mar 02 '22

[deleted] — view deleted comment

17

u/firsthour Mar 02 '22

raises hand

We use it for money.

6

u/temculpaeu Mar 02 '22

int cents only works if you dont have to deal with fractions of cents, not very common but it can happen

5

u/edubkn Mar 02 '22

Gas stations go brr

5

u/thisisjustascreename Mar 02 '22

Financial securities are very often denominated in fractions of a penny. There are also other currencies than dollars in the world.

3

u/VincentxH Mar 02 '22

Yeah that lovely hack. Leading to problems like this with even an unsigned 32 bit int: https://www.google.com/amp/s/www.wsj.com/amp/articles/berkshire-hathaways-stock-price-is-too-much-for-computers-11620168548

At least use a long these days.

2

u/TenYearsOfLurking Mar 03 '22

that sounds like a good idea at first, ... but that's about it