The Importance of Being Earnest is a capital-C Comedy. It ends happily, resolving any tensions in such a way that all the characters get what they desire. This means that all secret identities are revealed and all the couples can get married in a socially acceptable way. Woo-hoo! Wedding rings for everyone.
Jack turns out not to be the son of some random rich merchant (which would anger his potential mother-in-law, Lady Bracknell), but a legitimate aristocrat. In fact, he's Lady Bracknell’s nephew and Algernon’s older brother. This makes him Gwendolen’s cousin as well as lover. (We should note that marrying your cousin wasn't considered gross by Victorian standards; it was completely acceptable.)
So Jack/Ernest and Gwendolen get together. Algernon and Cecily get married as well. To top it all off, so do Miss Laetitia Prism and Dr. Frederick Chasuble. And just when the festivities are about to start, Jack says a key line: "I’ve now realized for the first time in my life the vital Importance of Being Earnest" (III.181).
What does he mean? Has he learned that he must live his life honestly? It doesn't seem like he has reformed his behavior: he doesn't apologize to Gwendolen about telling a lie. If he isn’t more honest at the end than he was at the beginning, what does this line mean? Perhaps that it is (still) important to be a man named Ernest so that Gwendolen will love him? Again: maybe, maybe not.
This last line is meant to be ambiguous. It could be interpreted either way. Check out our analysis in "What’s Up With the Title?" for a deeper view of what this last line means.