Similarly, (II Samuel 23:1) "And these are the last words of David': Now did he prophesy only these alone? Is it not written (Ibid. 2) "The spirit of the L-rd spoke in me and His word was on my tongue"? What, then, is the intent of "And these are the last words of David"? We are hereby taught that they were words of rebuke, viz. (Ibid. 6) "And (the men of) Belial shall as thorns be all of them cast away."
Similarly, (Koheleth 1:1) "The words of Koheleth son of David, king in Jerusalem": Now did Solomon prophesy only these alone? Did he not write three books? We are hereby taught that they were words of rebuke, viz. (Ibid. 4-7) "A generation goes and a generation comes … and the sun shines and the sun sets … It goes to the south and it turns to the north. Round and round (east and west) goes the wind … All the rivers run into the sea, yet the sea is not full." The wicked are spoken of as sun, earth, and sea, which have no reward.