Writing projects builds breadth. Solving algorithmic challenges builds depth. Doing both makes you a stronger programmer.
Here are the best platforms for Java practice:
LeetCode has thousands of problems sorted by difficulty. It supports Java with built-in test cases.
HackerRank offers guided tracks for Java. Problems start easy and introduce features step by step.
Codeforces focuses on competitive programming with timed problems.
Start with easy problems. If one takes more than minutes, read the solution, understand it, and try a similar problem the next day.