Do you understand what a "permutation" is? One permutation of "John" is "John", another is "oJhn", yet another is "nJoh". You can show that there are n! (n factorial) permutations of n distinct letters or other objects. Since "John" has 4 distinct letters, there are 4!= 24 permutations. Similarly, "Smith" has 4 distinct letters so there are also 4!= 24 permutations of that. Since any permutation of "John" can be used with any permutation of "Smith" there are (24)(24)= 576 different ways of writing those. If, in addition, you allow swapping the two names- that is "nJoh miSth" is one way, "miSth nJoh" is another- multiply that by 2: 1152.

(If you did not require keeping the two names separate, there would be 8!= 40320 ways to permute the 8 letters.)

More generally, if you have a "word" with kdistinctsymbols and another with j distinct symbols, there would be k! ways to permute the first, j! ways to permute the second, so (k!)(j!) ways to permute both. Again, if you allow swapping the two words, there would be 2(k!)(j!) ways.

Note that this does NOT apply to a general "word with k letters" because those "letters" must all be distinct. If the word were, say, "hello", there are 5 letters but not 5!= 120 ways of permuting them because many of them will have only the "l"s swapped and would not be "different words". That is, if we write "heLlo", then Lhoel is one permutation, lhoeL is another. But with "hello", they are the same word. Because there are 2!= 2 ways to interchange the "l"s, there are 5!/2!= 120/2= 60 ways to permute the letters of "hello".