From the course: IntelliJ IDEA Community Edition Essential Training

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Refactor code

Refactor code

From the course: IntelliJ IDEA Community Edition Essential Training

Start my 1-month free trial

Refactor code

- [Instructor] When you need to make changes to your code, you can do simple searches and replaces, but that can be error prone. It's always better if possible, to use refactoring. When you refactor, you're letting the IDE make the changes for you. It'll look at definitions of symbols and it can change both the definition and the references or usages of that symbol throughout an application. One of the simplest refactoring operations is renaming variables. Let's say I have a variable called person, which is an instance of a class called person, and this particular class has two different constructors. To learn about the constructors I'll place the cursor between the parentheses and press command P on mac or control P on windows, and I'll see that there are two constructors available. And no parameters or no arguments constructor, and one that lets me pass in initial values. I'll pass in three values, a first name, a last…

Contents