题目内容
(请给出正确答案)
[单选题]
给出以下代码,请问该程序的运行结果是什么? class Example{ public static void main(String[] args){ int a = 5; System.out.println(cube(a)); } int cube(int theNum){ return theNum*theNum*theNum; } } 请选择一个正确答案:
A.代码编译失败,因为方法cube()已经在java.lang.Math类上定义过
B.代码编译失败,因为方法cube()不是static方法。
C.代码编译成功,但运行期抛出异常。
D.打印输出125。
如搜索结果不匹配,请 联系老师 获取答案