It is not a good software practice and can lead to security problems.
It could also cause problems down the road when the password changes. You will have to re-compile the code in order for the application to be updated.
Here is one suggested way of not having to hard code your password and therefore allowing for your software to be more flexible and secure.
CWE-259: Use of Hard-coded Password
As suggested in the above link:
Apply strong one-way hashes to your passwords and store those hashes in a configuration file or database with appropriate access control. That way, theft of the file/database still requires the attacker to try to crack the password. When receiving an incoming password during authentication, take the hash of the password and compare it to the hash that you have saved.
Use randomly assigned salts for each separate hash that you generate. This increases the amount of computation that an attacker needs to conduct a brute-force attack, possibly limiting the effectiveness of the rainbow table method.