-->
当前位置:首页 > 题库

单选题:Given code below:

Luz5年前 (2021-05-10)题库1150
Given code below:
```Java
public class main {
public void main() {
System.out.println("Hello world\n");
}
}
```
Which statement is correct? @[D](2)

A. It does not compile because “main” is used for both class and function
B. It does not compile because constructor should not have a return value
C. It compiles and prints out "Hello world"
D. It compiles but JVM will say it can not find the main() in the class





A.It does not compile because “main” is used for both class and function
B.It does not compile because constructor should not have a return value
C.It compiles and prints out "Hello world"
D.It compiles but JVM will say it can not find the main() in the class


答案:D