This is from enthuware
test.
public class TestOuter
{
public void myOuterMethod()
{
// 1
}
public class TestInner { }
public static void main(
String[] args)
{
TestOuter to = new TestOuter();
// 2
}
}
Which of the following options correctly instantiates a TestInner object?
Select 2 correct options
a. new TestInner(); at //1
b. new TestInner(); at //2
c. new to.TestInner(); at //2
d. new TestOuter.TestInner(); at //2
e. new TestOuter().new TestInner(); at //1
The correct options given are
a. new TestInner(); at //1
e. new TestOuter().new TestInner(); at //1
I got the first one right.For the other instantiation ,I was searching for an answer to.new TestInner() at //2.
I felt it was kinda misleading to ask for an answer to be placed at //1 and //2 and giving the answers only for //1.May be I misunderstood the question!
Anyway ,my concern is not this qustion..but in the real exam, will there be any ambiguity as to how to answer the question?!
Because you know,I dont want to lose a question just because it has been worded in such a manner.
May be I am reading too much into this ...I dont know!
I just wanted to know if others felt this way or its just me...
With the exam date fast approaching,I might just be panicking!