Accidentally, while surfing Google, I found a game-like online platform for Java learning.
I know it may sound a bit childish, but why not? They are called Codegym. https://codegym.cc/
Had a quick look and it certainly looks very interesting, especially for a beginner. It happens to be free.