Question 10 / 297:  Which of the instantiations for a BlackBox are correct and compile-free?
Choose 2
public class OuterTest {

public static void main(String args[]) {

// instantiation 1

Airplane airplane = new Airplane();

Airplane.BlackBox box1 = airplane.new BlackBox();

// instantiation 2

Airplane.BlackBox box2 = new Airplane().new BlackBox();

// instantiation 3

Airplane airplane3 = new Airplane();

BlackBox box3 = airplane3.new BlackBox();

}

}

class Airplane {

class BlackBox {

}

}

<< First < Previous Next > Last >>
Explanation:

In instantiation 3, box3 should be declared as Airplane.BlackBox.

Exam Home Page
Ask
Copy and paste the following HTML code into your website or blog.
<iframe src="https://www.jobilize.com/embed/java-certification-questions" width="600" height="600" frameborder="0" marginwidth="0" marginheight="0" scrolling="yes" style="border:1px solid #CCC; border-width:1px 1px 0; margin-bottom:5px" allowfullscreen webkitallowfullscreen mozallowfullscreen> </iframe>