No.
When you declare variables at class level:
class egg extends food{
double protein;
double fats;
double carbs;
You are saying "I need these to exist as separate items for each instance of the class I create" and they are available to all code within the class.
When you create variables as parameters they are local top that metho: they are created when the method is called, and destroyed when the method ends. They are not the same as class level variables even if they have the same name.
In fact, if you had correctly declared your constructor method parameters:
public egg(double protein, double fats, double carbs){
...
then they would do something called
variable shadowing, which means that they would "hide" the class level variables of the same name and you wouldn't be able to get at the class level versions at all (unless you prefixed them with
this
which always references the current instance of the class:
public egg(double protein, double fats, double carbs){
this.protein = protein;
...
Using
this
tells the compiler "which version" of the variable you are talking about in each case.