nerdexam
GIAC

GSSP-JAVA · Question #26

GSSP-JAVA Question #26: Real Exam Question with Answer & Explanation

Sign in or unlock GSSP-JAVA to reveal the answer and full explanation for question #26. The question stem and answer options stay visible for context.

Question

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 here 5. 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"?

Options

  • ACar.Engine e = c.new Engine();
  • BEngine e = c. new Engine();
  • Cc.Engine e = Car.new Engine();
  • DCar.Engine e = Car.new Engine();

Unlock GSSP-JAVA to see the answer

You've previewed enough free GSSP-JAVA questions. Unlock GSSP-JAVA for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.

Full GSSP-JAVA Practice