The theme of town life versus country life in As You Like It is first shown in its controversial oppositional form, but the conclusion unifies the opposing forces and puts the two in balance through the changes in Oliver, Duke Frederick.
First, the idyllic pastoral life of the shepherds living in the forest of Arden is painted as one symbolized by communing with the birds in song, as Amiens' song reveals and as Corin's conversations suggest. Yet country life is not without trouble and conflict as seen by Corin's unrequited love for Phebe and Phebe's misguided and shunned love for Ganymede/Rosalind.
The courtly life is represented in keeping with Duke Fredericks' and Oliver's character traits and actions as they betray family members and friends and try to do murder to get their ways. Rosalind is exiled from town because of her openhearted embrace of that which is genuine and sincere. Celia goes with her because she would rather lose everything of material value than lose the values of integrity and sincerity.
In the ending, Oliver falls in love with Aliena/Celia who, like Rosalind, represents purity and sincerity as symbolized by the forest and the pastoral life. Later, Duke Frederick gives up his pursuit of vengeance and retires to a religious life in which Jaques joins him.
These character changes restore the country life exiles to safe lives in town, symbolizing that the villainy of the town life has to yield at some point to higher virtues. The changes also show that it is the nature within the character that creates villainy or goodness whether in town or country. Shakespeare thus has balanced the divisions between town life and country life by showing the villainy or virtue is in essence a problem of human nature, which he suggests, can be changed.