The answer is: Rationalization
In defense mechanism, rationalization refers to the act of justifying our own negative behavior in order to prevent negative feelings rather than acknowledging the real reason for it.
For example, let's says that there is a student who never really use his time to study for the exams. So, when the exam came, he decided to cheat even though he know that it's wrong. To justify this, he told himself that 'I need to cheat rather than making my parents pay more tuition'.