They are both correct.
I am a twenty-year-old student:
- "20" and "year" are linked by the hyphen to create a single term ("20-year") that modifies "old."
- "20-year" and "old" are linked by the hyphen to create a single term ("20-year-old") that modifies "student."
I am twenty years old:
- "old" is a predicate adjective for "I." (as in "I am old.") As a single-word adjective for "I," it is not joined with a hyphen to the previous adjective, "years."
- "years" modifies "old," and "20" modifies "year". "20" and "years" are not acting as a single adjective for "old," so they, too, do not need a hyphen.
The easy understanding:
If the adjective phrase serves as a single modifier before the noun (student, in the second sentence), it needs a hyphen (or hyphens, as in this case). Adjective phrases have no plural forms on the words forming them (the word year you asked). When you use a noun as an adjective (year-old), it must be singular. That's why there is no -s there.
If it is after the noun, it doesn't need a hyphen (or hyphens). When the same words (years) are used not as an single adjective, which means they modify the noun separately, the noun is plural. That's why there is an -s there (unless it's She is 1 year old).
Another example:
- The ceiling is ten feet high.
- The room has a ten-foot ceiling.
Commas are used between adjective words or phrases when the adjective independently has certain properties: for instance it is not primarily attributed with one, and then with less importance for the other attributes.
The commas are not necessary where the meaning is obvious.
Compare:
red, long boots [Boots which are red, and which are long]
red long boots [Could be: "boots which are red and which are long" or it could be red (long boots): a type of footwear (long boot, written as two words) which is red.
Since "red bicycle" is not understood as a special type of bicycle, the comma doesn't help to clarify anything. We know without the comma that "little red bicycle" means "bicycle which is little and which is red".
"red [something]" could be a special kind of something. For instance "red book" could have a meaning other than simply a book whose cover happens to be red. Because it is not the official name of the book, and the nickname is only used by a small group of people, it is not capitalized as Red Book. (See Dragon Book for instance).
These rules were not in the old red book. They are only in the new one. ["red book" is a code name for some book of rules, whose jacket is not even red anymore in its recent editions.]
The old man opened the old, red book and read a story his grandson. ["he opened a book which looked old, and had a red cover.]
In the second example, we can drop the comma, because the old man is probably not reading stories from some special "red book of stories" that isn't actually red colored. If it were the title of the book, it would be capitalized Red Book, and then the comma would be entirely inappropriate.
In the first example, we may not add a comma.
How about with more than two adjectives. Continuing with the "red book":
Use the reliable, current red book; forget last year's red book. [It is a red book, first and foremost: a special type. Then it is simultaneously current and reliable.]
Refer to the reliable, current, red book; forget the outdated blue one. [Use the current book which is reliable, and which is identified by its color red.]
The presence or absence of a comma does not resolve everything. For instance:
deep blue swimming pool [Is the color "deep blue", or is it a deep pool that is, like many swimming pools, is blue?]
If we add the comma, we clarify that the second interpretation is intended. If we omit the comma, it remains ambiguous.
In speech, we can say "deep blue" as one word, and leave a pause afterward, but in writing "deep-blue" or "deepblue" would be considered erroneous.
This is one of those situations in which the written language must be restructured to avoid ambiguity, where spoken language doesn't have to.
deep blue colored swimming pool
swimming pool painted deep blue
That brings us to compound adjectives. You can see how the commas are visually helpful in breaking up the clusters of words into chunks:
deep blue colored, round cornered, public swimming pool
Commas are practically mandatory in situations like this; it looks quite bad when written without commas, and far worse with misplaced or inconsistent ones:
* deep, blue colored, round cornered public swimming pool [Now it is deep and blue, which changes the meaning, and what in the world is "round cornered public"?]
? deep blue colored round cornered public swimming pool [Better without commas than with wrong ones; reader can work it out.]
In the first example, the writer confused the reader because he or she started using commas to separate the nouns, creating the expectation that commas are being used consistently and correctly, but then neglected to do so between "cornered" and "public".
Inconsistency and incorrectness with regard to the placement of commas can often be worse than neglect to use commas at all.
Best Answer
After thinking it through, I think the best response of the teacher (you!) for this particular student once he or she asked,
is probably,
And if he or she looked confused, then you could add,
If your course is about conversational English and it doesn't emphasize grammar, perhaps this is the best way to go, in my opinion. There is no grammar terminology in the reply. (Please note that I avoided even using the word "either" intentionally.)
However, if your course also includes grammar, then you can take it as a good opportunity to discuss with your student(s) the concept of singular vs. plural in English, and the possessive form of you (which is your) and other pronouns, and how to find the main word in a noun phrase, and sentence structures in English, and so on.