In the call outs or Integrations that we do from Salesforce to External Systems, we should pass the Endpoint URL and Password in the Header to hit the External System.
Using the Named Credentials we can Put these Endpoint URL and Password in a Label and can expose that label in the code.
Below are the Steps for Navigating to Named credentials:
Setup -> Type Named Credentials -> Setup the Named Credentials with all the details
This is considered as one of the best practices (Not exposing the URL and Password in the code)
– Sumanth A [10/25/18]