52.1k views
4 votes
Assume that you have created a class named DemoCar. Within the Main() method of this class, you instantiate a Car object named myCar and the following statement executes correctly: WriteLine("The Car gets {0} miles per gallon", myCar.ComputeMpg()); Within the Car class, the ComputeMpg() method can be _________. Group of answer choices

1 Answer

2 votes

Answer:

It can be static, but it shouldn't, given the way it is invoked.

It can also be protected but not private.

Step-by-step explanation:

The question is confusing, since the ComputeMpg() should be a public non-static member. Also, is this Java or C#?

User PJW
by
4.4k points