It was possible for Adam before the fall, to form a righteous character by obedience to God’s law. But he failed to do this, and because of his sin our natures are fallen and we cannot make ourselves righteous. Since we are sinful, unholy, we cannot perfectly body the holy law. We have no righteousness of our own with which to meet the claims of the law of God. But Christ has made a way of escape for us. He lived on earth amid the trails and temptations such as we have to meet. He lived a sinless life. He died for us, and now He offers to take our sins and give us His righteousness. If you give yourself to Him, and accept Him as your Saviour, then sinful as your life may have been, for His sake you are accounted righteous. Christ character stands in place of your character and you are accepted before God just as if you had not sinned.
More than this, Christ changes the heart. he abides in your heart by faith. You are to maintain this connection with Christ by faith and the continual surrender of your will to him; and so long as you do this, He will work in you to will and to do according to His good pleasure. So you may say, “The life which I now live in the flesh I live by the faith of the Son of God, who loved me, and gave Himself for me.” Galatians 2:20. So Jesus said to His disciples, “It is not you that speaks, but the Spirit of your Father which speaks in you.” Matthew 10:20. Then with Christ working in you, you will manifest the same spirit and do the same good works – works of righteousness and obedience.
So we have nothing in ourselves of which to boast. We have no ground for self-exaltation. Our only ground of hope is in the righteousness of Christ imputed to us, and in that wrought by His Spirited working in and through us.