阅读下列Java代码,运行后正确的输出结果是( )。
public class People {
int energy=0;
public int eat(String food){
if("青菜".equals(food))
return 5;
else if("肉肉".equals(food))
return 10;
return 0;
}
public static void main(String[] args) {
People people=new People();
people.energy+=people.eat("肉肉");
System.out.println("能量值是:"+people.energy);
}
}
A.能量值是:0
B.能量值是:5
C.能量值是:10
D.编译错误