What is the output?

Given the following code for a Planet object:

What is the output?

A. Option A
B. Option B
C. Option C
D. Option D
E. Option E

Download Printable PDF. VALID exam to help you PASS.

6 thoughts on “What is the output?

  1. String name ;
    int moon;
    Q90(String name,int moon){

    public static void main(String[] args) {
    Q90 plants[]={
    new Q90(“Mercury”,0),
    new Q90(“Venus”,0),
    new Q90(“Earth”,1),
    new Q90(“Mars”,2)

  2. Answer C:

    Because planets and plants[2] are objects, so applying print() method on them will print their location in memory. But planet[2].moons will print the actual value of the moons in the Earth object.

Leave a Reply

Your email address will not be published. Required fields are marked *

The reCAPTCHA verification period has expired. Please reload the page.