My grandfather once gave me an interesting bit of advice that contradicts what a lot of people might tell you about credit cards. For a number of my friends, even having credit cards represents a source of fear for them. Some of my friends refrained from getting one for a long time or hardly used the 1-2 they DID have. What did that get them? Bad credit!
There's a sort of stigma and fear that it's literally spending money you don't necessarily have. In some sense that is true, but like anything, if used responsibly and in moderation, it's rather easy to use credit to your advantage. If you can, it's nice to be able to pay them off ASAP, but that's not always the reality of the situation. The trick is not treating a credit card like an extra spending account. You never want to be in a situation where you are only paying the minimum payment each month.
In all of this, the real enemy when it comes to credit cards are the interest rates / APR (annual percentage rate).
When you get charged interest in any sort of a line of credit or loan, they're literally charging you for a percentage of your debt. Some credit cards leap as high as 20%. Though it should be obvious, that means for every $100 you carry as a balance, you are getting charged $20 just to hold that balance! Interest charges happen monthly, so if you're carrying a balance on a card that has a high APR, you're doing it to yourself.
Many cards will offer introductory 0% APR periods for 12, 15, or even 18 months. That can be up to a year-and-a-half of spending where you don't get charged for it, so long as you pay your monthly minimums. Particularly while in undergrad and grad school, using exclusively these sorts of cards and paying the total balance off ASAP, made everything much easier financially.
In the event that you do carry a balance when it comes time for that introductory APR to run out, you'll want to transfer it to a new card. In many cases, you'll pay a 3%-ish transfer fee, which is a whole lot better than paying 20% interest on the credit card once that intro APR expires. Many credit card companies actually incentivize these kinds of shifts.
It's less than ideal to have many lines of credit as well, so once you have an older card that is obsolete, you can cancel the account.
As a side note, it's always best to avoid the cards that have annual or even monthly fees. Sometimes the upfront offer might look enticing, but oftentimes that is to lure you into something that down the line might not be in your best interest.