It is given that,
John has 4 different flags that he wants to hang on the wall.
To find the number of different ways can the flags be arranged in a row:
There are 4! ways can the flags be arranged in a row.
That is,

Hence, the answer is 24 different ways.