Câu 5: GSSP-Java: GIAC Secure Software Programmer-Java
You work as a Programmer for InfoTech Inc. You write the following code.1. public class InnerDemo{2. public static void main(String[] args) {3. Car c = new Car();4. // insert code here5. e.test();6. }7. }8. class Car{9. class Engine{10. void test() {System.out.println("test"); }11. }12. }Which of the following options…
Nội dung câu hỏi
You work as a Programmer for InfoTech Inc. You write the following code.1. public class InnerDemo{2. public static void main(String[] args) {3. Car c = new Car();4. // insert code here5. e.test();6. }7. }8. class Car{9. class Engine{10. void test() {System.out.println("test"); }11. }12. }Which of the following options should you add to line 4 so that the code compiles and produces the output "test"?
Các lựa chọn
Đáp án được giữ gọn theo nhãn A, B, C, D trong phần bình chọn tương tác.
- A. Car.Engine e = c.new Engine(); — đáp án hiện tại
- B. Engine e = c. new Engine();
- C. c.Engine e = Car.new Engine();
- D. Car.Engine e = Car.new Engine();
Cộng đồng
0 bình luận công khai. Tên thành viên được ẩn một phần.