package oop4;
package oop4;public class as {\x05static class VolcanoRobot {\x05\x05String status;\x05\x05int speed;\x05\x05float temperature;\x05\x05void checkTemperature() {\x05\x05\x05if (temperature > 660) {\x05\x05\x05\x05status = "returning home";\x05\x05\x05\x05speed = 5;\x05\x05\x05}\x05\x05}\x05\x05void showAttributes() {\x05\x05\x05System.out.println("Status:" + status);\x05\x05\x05System.out.println("Speed:" + speed);\x05\x05\x05System.out.println("Temperature:" + temperature);\x05\x05}\x05\x05public static void main(String args[]) {\x05\x05\x05VolcanoRobot dante = new VolcanoRobot();\x05\x05\x05dante.status = "exploring";\x05\x05\x05dante.speed = 2;\x05\x05\x05dante.temperature = 510;//从这开始请问是怎么执行的?\x05\x05\x05dante.showAttributes();\x05\x05\x05System.out.println("Incresing speed to 3.");\x05\x05\x05dante.speed = 3;\x05\x05\x05dante.showAttributes();\x05\x05\x05System.out.println("Changing temperature to 670.");\x05\x05\x05dante.temperature = 670;\x05\x05\x05dante.showAttributes();\x05\x05\x05System.out.println("Checking the temperature.");\x05\x05\x05dante.checkTemperature();\x05\x05\x05dante.showAttributes();\x05\x05}\x05}}
最佳回答
VolcanoRobot对象有三个全局变量status、speed、temperature。执行主函数时先实例化VolcanoRobot对象,然后给三个变量赋值。再后来调用showAttributes()方法输出变量的值。输出结果:Status:exploringSpeed:2Temperature:510。0Incresing speed to 3。Status:exploringSpeed:3Temperature:510。0Changing temperature to 670。Status:exploringSpeed:3Temperature:670。0Checking the temperature。Status:returning homeSpeed:5Temperature:670。0 再问: 是不是 每次都执行 System。out。println("Status: " + status); System。out。println("Speed: " + speed); System。out。println("Temperature: " + temperature);
最新回答共有2条回答
-
2026-04-08 23:40:13冷静的白昼
回复VolcanoRobot对象有三个全局变量status、speed、temperature。执行主函数时先实例化VolcanoRobot对象,然后给三个变量赋值。再后来调用showAttributes()方法输出变量的值。输出结果:Status:exploringSpeed:2Temperature:510。0Incresing speed to 3。Status:exploringSpeed:3Temperature:510。0Changing temperature to 670。Status:exploringSpeed:3Temperature:670。0Checking the temperature。Status:returning homeSpeed:5Temperature:670。0 再问: 是不是 每次都执行 System。out。println("Status: " + status); System。out。println("Speed: " + speed); System。out。println("Temperature: " + temperature);
热门文章
- 康达学院专转本五年制
- 高考一个考场分ab卷吗
- not only but also用法
- 某物体做自由落体运动,从释放开始计时,则物体在前2s内的平均速度为______m/s,物体下落2m时的速度大小为______m/s.
- 三角函数公式大全表格
- 地理中考必背知识点2022
- 2013-2014学年小学六年级科学上学期期末考试试卷及答案
- 人教版2014-2015学年小学五年级英语第二学期期中教学质量检测试卷及答案
- 【Linux驱动开发】设备树详解(二)设备树语法详解
- 别跟客户扯细节
- 在别的城市买房子能落户吗
- 卖房前要把装修贷还完吗
- 高中政治教学提高教学效果的方法探究
- “互联网+”背景下的初中英语课堂教学改革与创新策略研究
- 2022年终止合同范本
- 租房合同范本范文
- 如何挑选土豆
- 如何挑选土鸡
