Not without quotes and punctuation:

James, while John had had “had,” had had “had had;” “had had” had had a better effect on the teacher.

The context is two students writing a sentence on some graded work, such as:

Bill had the measles. Bill had had the measles.

When wanting to know why James scored better, the sentence above explains the reason, although I'd probably explain it like this:

James scored better because he used the right verb: had had, instead of just had.

The sentence is not unlike the famous Buffalo sentence; it's a contrived example to show how many times a single word can be strung together consecutively in a sentence. Another example is the sign maker who criticizes her own work by saying:

I should have put more space between ham and and and and and eggs.

on a sign that that looks too much like TODAY'S SPECIAL: HAMANDEGGS .