I teach a Java class, and students often gravitate toward strings because of their functionality. Why try to get the third digit from a number using math (i.e. (5092 / 10) % 10) when you can convert it to a string and call the index method on it (i.e. Integer.toString(5092).charAt(3))?
Not making an excuse for this code! It's bad, but I can see why people do it. haha In this case, it really makes no sense.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I teach a Java class, and students often gravitate toward strings because of their functionality. Why try to get the third digit from a number using math (i.e.
(5092 / 10) % 10
) when you can convert it to a string and call the index method on it (i.e.Integer.toString(5092).charAt(3)
)?Not making an excuse for this code! It's bad, but I can see why people do it. haha In this case, it really makes no sense.