The opportunity cost of going to college is the money a person would have earned if he/she worked instead. On the one hand, he/she lose four years of salary while getting his/her degree; on the other hand, he/she hopes to earn more during their career, thanks to their education, to offset the lost wages.
In terms of investment it can be explained as:
A person is having Rs.10,000 which he wants to invest. He invests in shares of a particular company which gave him return of 4%. Instead of investing in shares if he could have invested in Government bonds, he could have got return of 8%. In this situation, the opportunity costs is 4%(8% - 4%).