Menu
Question Index
...

Which option will be placed in 'Write code here' then, produce the output 'Hello World'?

public class Computer {
    class HardDisk {

        //Write code here.

    }
    public static void main(String args[]) {
        new Computer().display();
    }
    void display() {
        new HardDisk();
    }
    void memory() {
        System.out.println("Hello World");
    }
}


Computer.memory();
this.memory();
HardDisk()
{
    Computer.memory();
}
HardDisk()
{
    Computer.this.memory();
}
None of the above

Doubts

Problems

Topic: Calling A Class From Another Class In Java

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App