Hi everyone! I’m new to the course and am currently at Lesson 4 (Extracting the Console Class) of “Refactoring Towards an Object-oriented Design” in Ultimate Java Part 2 (Object-oriented Programming). I’m trying to work on the source code while watching the course video but have encountered a technical problem. After downloading and opening the source code, I don’t see the project tree as shown in the course. Instead, my project tree looks like this:
The trouble is, when I try to do the refactoring procedure for “readNumber” I get stuck with the “codewithmosh” part in the “To” text box being marked red, as shown in the screenshot above. I’m basically stuck at this dialog box, and clicking “Refactor” (the button in blue) does nothing. I’m guessing that it might be because something is missing from the project tree or the package setting, but I can’t figure out what is missing or what I should do.
Could anybody here help? Thanks!
the fully qualified name needs to be there, the part in red if part of that, it’s the name of the project followed by the class (“Console”), you need to make sure that the class exist or ask the IDE to create one. Click on the … and indicate where will move the members to.
Thank you for your reply, @King_Sardius! I am a real beginner and don’t understand some of the terms you are using. Could you be so kind and explain in more detail what I should do to make the code work? After clicking the three dots I see nothing, as shown in the screenshot below:
Using my own code as an example, you chose the “Move Members” option. If you click on “project” you will see all classes listed, and then you can choose where to move those members to. Just make sure the class that you want to use is already created, or create one:
Thank you very much for the follow-up reply, @King_Sardius ! I have followed your steps and see this screen:
As you can see, I have manually created a folder named “com.codewithmosh.” But still, the dialog box doesn’t allow me to click “OK” (which is grayed out). What have I done wrong?