Search code examples
javaintellij-14

How to add parameter label in IntelliJ?


I just started using IntelliJ and while creating my first class and method I noticed something. When I wrote GomokuClient(4000); to call on a class from a imported library I of course got a error for the code not being complete, so I pressed the little red bulb to see the issue, and I selected the recommended fix. The fix looked like this:

enter image description here

Now I'm wondering, how do I write the portNumber:label in the parameter myself for other methods. Looked really nice and very helpful, and I'd like to know how to do this myself.

thanks beforehand!


Solution

  • The fix done by the IDE was not about setting parameter label, but instead adding the new() for ensuring the constructor call.

    What you additionally see there is a feature of IntelliJ to show method's parameter hints/labels for easy understanding (readability) of the code. You can read more about parameter hints here: https://www.jetbrains.com/help/webstorm/viewing-method-parameter-information.html.