The short answer is Yes.
The complicated answer (filtered through my mind and simplified for human consumption) is yes and here’s why…
The human body treats all caloried the same: as energy. And when that energy is not used, it is stored in the body in the easiest usable form: fat.
Fat tends to go to specific places on the body depending on age, sex, and genetics (belly for men, hips and thighs for women). If you eat calories of any type and don’t use them, you’ll get fat.
Now your body uses a minimum amount of energy just to breath, circulate blood, and just live. If you eat just that amount each day and sit around doing nothing, you will stay the same weight. If you move around, you will need extra calories to produce the same amount of energy you expend.
Now the source of the calories are at the center of weight-loss programs and, for the most part, they do have only a minimal significance. Sugars will trigger an insulin reaction, gving you temporary energy then making you tires. Carbohydrates (more complex sugars) give you smaler reations, but are still short term. Protiens are needed to build muscle and hair and nails. And Fiber is non-digestible and can clean out your digestive track either by absorbsion (soluble fiber) or by pushing stuff out (insoluble fiber).
You can gain weight by building fat or you can gain weight buy building muscle and bone density. That is why you have to not only watch how many calories, but where you get them. Still, if you don’t use them, they will still turn to fat.