Why does the check engine and brake light stay on a 2000 Miisubishi Montero Sport?

i have a 2002 montero sport i had the same issue i replaced the brake pads first no luck 2 days later i had to replace the alternator after that both lights went off