Trying nine wrong solutions to a problem before finding the tenth, which actually succeeds, is frequently an essential part of the learning process, in writing natural language as in programming.
I used to know java sdk by memory whe I was young. Nowdays theres too many languages I have to remember. Easier just to ask copilot.