They know they should get paid very early on the list if the company declares bankruptcy. General creditors, such as suppliers of goods and services, and other lenders and bondholders, have a greater potential for recovering their losses than stockholders, because bonds represent the debt of the company and the company has agreed to pay bondholders interest and to return their principal. Stockholders own the company, and take greater risk. They could make more money if the company does well, but they could lose money if the company does poorly. The owners are last in line to be repaid if the company fails.
Bankruptcy laws determine the order of payment.
Most publicly-held companies will file under Chapter 11 rather than Chapter 7 because they can still run their business and better control the bankruptcy process. Chapter 11 provides a process for rehabilitating the company's faltering business. Under a Chapter 11 reorganization, a company usually keeps doing business and its stock and bonds may continue to trade in our securities markets. The U.S. Trustee, the bankruptcy arm of the Justice Department, will appoint one or more committees to represent the interests of creditors and stockholders in working with the company to develop a plan of reorganization to get out of debt. The plan must be accepted by the creditors, bondholders, and stockholders, and confirmed by the court.