Second
Then David comforted his wife Bathsheba, and went in to her and lay with her; and she gave birth to a son, and he named him Solomon.
2 Samuel 12:24
Fourth
These were born to him in Jerusalem: Shimea, Shobab, Nathan and Solomon, four, by Bath-shua the daughter of Ammiel;
1 Chronicles 3:5
SAB Contradiction 422
Why the critic is wrong
The first child of king David and Bathsheba died soon after its birth and thereafter they had a second son named Solomon (text 1). In text 2 Bathsheba is named Bath-shua and it is not quite clear what the meaning is. According to the critic it is wrong that in 1 Chronicles 3:5 Solomon is mentioned in fourth position as he was in fact the oldest of the four sons. The critic would be right if it was prescript that the oldest son was to be mentioned first. However there is no such rule at all. So there is no Bible Contradiction at all.
A change for a main character
It should not be supposed that each genealogy has always followed the historical order of the individuals in it. Sometimes a change had been made, e.g.: 1 Chronicles 3:15-16. (Cf. the article: How old was Jehoiachin when he began to reign?). Changes in genealogies could be made for a specific reason. Especially for main characters in the story. It could be important to make a change as his position was already known for the readers.
A change for Solomon
Royal genealogies normally had the function to give in order of importance: from old to young, from the first in heritance to the last. However there was no need to follow this custom for Solomon as David had already given the promise early on to Bathsheba that Solomon would be his successor (1 Kings 1:13). So there was no compelling reason to give Solomon the first place in the genealogy. Everybody knew that Solomon was the first living son of David and Bathsheba.
David’s love for his sons
By giving Solomon the last place of the four sons of Bathsheba, the writer in fact gave the other sons a place before Solomon. It was certainly a signal that they were as important to David as Solomon and that nobody should disdain them because of his (David’s) transgression with Bathsheba.
Why Solomon as king?
Why was Solomon appointed by David as his successor? Probably the sons of David that were born earlier revealed themselves as not being qualified for the task (1 Chronicles 3:1-4). Morally. Amnon raped his half sister; Absalom murdered Amnon because of it and also organized a revolt against David; Adonia also rebelled against David for the succession. Physically or intellectually, three other sons born before Solomon probably didn’t have the right qualifications to rule over the nation.
No Bible Contradiction