He was a prophet, and he knew what God had promised him: God had made a vow that he would make one of David's descendants a king, just as David was.