It is safe as long as you keep your wits about you. The same basic rules of caution apply.
But thanks to strict gun control laws there are a lot less guns and violence in the street. You are far more likely to have your pockets picked or get beaten up for your money than to get robbed with a gun and shot by a nervous trigger-happy junkie.
Also, how expensive would it be to travel around staying at hostels for a few months?
Very. You can reasonably expect to pay 80-120 USD for every day that you spend travelling in Europe. So for 3 months (90 days) plus the approx. 1000 USD for the flight ticket you are looking at around 10,000 USD.
There are ways to do it cheaper, but this is a good starting point. If I was you I would start saving every cent right now. If you are in college look at studying abroad for a semester, if you are in highschool announce that you dream of going to Europe and that instead a big party or big gifts for graduation you want money. Many people who are in a similar situation like you manage to get the flight tickets and a Eurail pass as gifts from parents and relatives.