PRO192_-_SP_2024_-_Block_5_-_FE_1921.webp
K

PRO192_-_SP_2024_-_Block_5_-_FE_1921.webp

Multiple Choices
Answer (Choose 1 answer)
Consider the following class:
1. class Test {
void foo(int i) {
System.out.println("int version");
}
void foo(String s) {
2345678
System.out.println("String version");
7. }
9.public static void main(String args[]) {
10.Test t = new Test();
11.char ch = 'p';
12.t.foo(ch);
13. }
14.}
Which of the following statements is true?
A. Line 5 will not compile, because void methods cannot be overridden.
B. Line 12 will not compile, because no version of foo() takes a char argument.
C. The code will compile and produce the following output: String version.
D. The code will compile and produce the following output: int version.

Thông tin

Category
PRO192
Thêm bởi
Kurourushi89
Ngày thêm
Lượt xem
4,769
Lượt bình luận
23
Rating
0.00 star(s) 0 đánh giá

Share this media

Back
Bên trên Bottom