I'll go against the tide here, since much of the advice in this thread seems to be from people who have gone through bad experiences, and laying on advice that might make you feel cynical or cautious about your work life. When life deals you a bad hand, it's important to not over-correct in the other direction. Digest the lesson, but don't assume doing the opposite of what you did before will result in better results. Try to integrate the lesson into a greater whole. Be cautious of views that are superficially contrarian, if you see many people holding them.
Work hard. When you are young, this is the best time to go deep, and get good at something, since you are free from other responsibilities. Later, you will have many things you care as much or more about than work, and so the time in your life will have passed to be as deeply engaged with your work. A lot of the work you do will ultimately be lost, be failures, or end up in the trash bin for other reasons -- take comfort knowing that the work was done to mold you into the person you will become, not for the sake of the project itself.
Read Hamming's "The Art of Doing Science and Engineering." Have a plan, even though it will change with time, to move your career towards working on things you think are important. Even if you don't know what those are, make a point to "check in" with yourself every year or so to ask the question: "Am I working on the most important problems in my field? If not, why?" This doesn't mean you will always be working on these problems, and it doesn't mean that it's wrong to not be, it just means that you should always have a plan, a path, and a strategy towards getting there, and catching yourself if you are falling off-track.
Understand regret minimization as a framework for making good decisions.
Most of all, avoid listening too closely to advice :) Realize there are many paths through life, and yours is your own to write. Luck favors the prepared mind: prepare yourself, through work, and through reflection, to be able to recognize the doors that will appear that are uniquely suited for you to walk through. And, when they do, don't hesitate to go through them: the world, your peers, and 'common sense', will often try to pull you away from them.
Work hard. When you are young, this is the best time to go deep, and get good at something, since you are free from other responsibilities. Later, you will have many things you care as much or more about than work, and so the time in your life will have passed to be as deeply engaged with your work. A lot of the work you do will ultimately be lost, be failures, or end up in the trash bin for other reasons -- take comfort knowing that the work was done to mold you into the person you will become, not for the sake of the project itself.
Read Hamming's "The Art of Doing Science and Engineering." Have a plan, even though it will change with time, to move your career towards working on things you think are important. Even if you don't know what those are, make a point to "check in" with yourself every year or so to ask the question: "Am I working on the most important problems in my field? If not, why?" This doesn't mean you will always be working on these problems, and it doesn't mean that it's wrong to not be, it just means that you should always have a plan, a path, and a strategy towards getting there, and catching yourself if you are falling off-track.
Understand regret minimization as a framework for making good decisions.
Most of all, avoid listening too closely to advice :) Realize there are many paths through life, and yours is your own to write. Luck favors the prepared mind: prepare yourself, through work, and through reflection, to be able to recognize the doors that will appear that are uniquely suited for you to walk through. And, when they do, don't hesitate to go through them: the world, your peers, and 'common sense', will often try to pull you away from them.
Good luck!