Yes, both sharks and whales are marine animals, meaning they live in the ocean's saltwater environment.
Sharks are fish belonging to the class Chondrichthyes. Whales are mammals belonging to the order Cetacea.
Although they differ greatly in biology and evolutionary history, they both share the ocean as their home.