Mammals have external qualifying characteristics like body hair, ear pinna, etc. But a whale has none of that. So, can it be identified as a mammal just by external observations?
A whale has a horizontal tail fin which is a typical feature of mammalian marine animals see link. Mammalian sea animals typically have a vertical movement of the tail fin for swimming. Fishes like sharks have a vertically oriented tail fin and move it side-ways for locomotion.
Identification of an organism to a taxonomic rank (Class Mammalia) is not based only on morphological characteristics. It is a function of all characteristics that members of that rank share to the exclusion of others. Mammals have multiple features that have been mentioned before (the obvious ones are milk and hair) that they all share that are not present in other taxa. If you only based identification on external morphology you would risk grouping organisms based on convergent evolution (e.g., bats and birds would be in the same taxa).