Menu
Question Index
...

Which of the following instantiated objects defined in the instantiatedTest() method are valid instantiations?

public class ValidOrNot {
public class X {    }
public static class Y {    }
    public void instantiatedTest() {
        new ValidOrNot().new X(); //M
        new ValidOrNot.Y(); //N
        new X(); //O
        new ValidOrNot.X(); //P
    }
}


Only M
Only O
M and O
N and O
M, N, O and P

Doubts

Problems

Topic: Static and Non Static Variables - Static and Non Static Methods

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App