No, we cannot modify apex classes and triggers directly in the production environment. It should be done first in Developer edition or testing org or in Sandbox org. Then, a user with Author Apex permission can deploy it in production, which overwrites the last version.
Visualforce pages can easily be generated and modified in Sandbox and in production too if it does not consist of a Custom Controller.
Want to know How much a Salesforce Developer makes! Check out our blog Salesforce Developer Salary.