Mono-spaced for fixed-width fonts are preferred for writing code because they better differentiate between certain characters (such as upper-case I and lower-case l) and they also give more space to important characters like the exclamation point, semi-colon, brackets/braces, etc. Reading these different kinds of characters is harder when using a variable-width or proportional font, and can therefore cause errors and problems in your code.
Using mono-spaced fonts also makes it easier for characters to line up. For example, when you indent your code using tabs or create some output in rows and columns, it's easier for things to align with a fixed-width font. This is because proportional fonts' characters are all different widths, but in a fixed-width font, all characters are exactly the same width.
Which mono-spaced font should you choose? Most editors use Courier New or Lucida Console, but those aren't the best at differentiating between certain characters. A long time ago, I found the Ubuntu Mono font, and a couple of years ago a student showed me the Fira Code font (Fira Code already comes with the IntelliJ IDE). I like these 2 fonts because it makes those confusing characters appear completely different.
Getting and installing these fonts is super easy. Here are the zip files for both fonts (you only need one, but you might want to download both and choose the one you like best):
Installing a font is really easy! Unzip the zip file to its own directory (your zip utility should have a quick option for this: with mine I just right-click the zip file and select "extract to /zipFileName" to extract all the files inside the zip to a new directory that has the same name as the zip file).
Once you've unzipped the file, select the fonts you want to install (you can Ctrl- or Shift-click like you do with any set of files) and then right-click > Install. That's it!
If you're unable to install that way, just double-click a font file, then click the "Install" button in the dialog box. Do this for each font file.
If your editor is running, restart it and then go to your settings and change your font.
Fira Code should already be available if you installed IntelliJ. If you want to use Ubuntu Mono, install it first and then restart IntelliJ. To change your font, do the following:
The instructions above will likely work in a similar manner with any other editor or IDE. Shut down your editor/IDE and then install the fonts. Restart your editor and use the preferences/settings to change the fonts.