Final answer:
A housefly develops an electric charge through frictional charging, a process where electrons transfer from one surface to another when two different materials come into contact and are then separated.
Step-by-step explanation:
The process through which a housefly develops an electric charge as it walks across a surface is similar to frictional charging. This occurs when two different materials come into close contact, one of which may hold onto electrons more tightly than the other. When they are separated, especially if they have been rubbed together, electrons can transfer from one surface to the other, leaving one object with a surplus of negative charge and the other with a positive charge. This is analogous to walking across a carpet and then touching a doorknob, which can result in a spark as the excess charge is released.