Which of these lines when placed in line 1 will create an instance of class Inner? (select all that apply).

class Outer {
	public class Inner { }
	Inner getInner(){ return new Inner(); }
	public Outer() { }

public class Starter {
	public static void main(String[] args) {
Neither class Inner, nor method getInner() are static, therefore you need to have an instance of class Outer to create an instance of class Inner.

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Keep exploring
Java quizzes
Sign Up Now
or Subscribe for future quizzes