Question: Given the following class declaration, which options correctly declare a local variable containing an instance of the class? A. new Sunset() extends Sky {}; B.

Given the following class declaration, which options correctly declare a local variable containing an instance of the class? 

public class Earth { } private abstract class Sky { void fall()

A. new Sunset() extends Sky {};

B. new Sky();

C. new Sky() {}

D. new Sky() { final static int blue = 1; };

E. The code does not compile regardless of what is placed in the blank.

F. None of the above.

public class Earth { } private abstract class Sky { void fall() { var e= } }

Step by Step Solution

3.45 Rating (174 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

The image depicts a snippet of Java code for a public class named Earth which contains a private abs... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Oracle Questions!