Automated and Manual Refactorings

We will learn automated and manual refactoring to reduce the code junk overheard.

Refactoring code is always a delicate task which can lead to a bigger misunderstanding if not done carefully.

In our case, the answer local variable doesn’t clarify the code, and it’s used only once. Inline (remove) the variable by replacing its use with the answerMatching(criterion) expression (line 2) in Profile.java:

Get hands-on with 1200+ tech skills courses.