Jesus states that obedience to God is not limited to external actions (adultery) but begins from the inside. The righteousness demanded by God is impossible for man, so we can not get to heaven based on our actions. Only Jesus was able to fully obey God and through His sacrifice on the cross he justifies (makes righteous) who puts his trust in him and gives him/her eternal life.