Exam 1z0-808 All QuestionsBrowse all questions from this exam
Question 58

Given this code for a Planet object:

What is the output?

A.

B.

C.

D.

E.

    Correct Answer:

Discussion
Vicky_65

Answer is B only.

shivkumarx

I've tested the code and I'm getting option B as answer

shivkumarx

Idk what I was smoking but this is clearly wrong

haisaco

Answer is B.

akbiyik

Answer is B.

morgan3987

Correct Answer:B

carloswork

Tested. Answer is B. Source code: public class Planet { public String name; public int moons; public Planet (String name, int moons) { this.name = name; this.moons = moons; } public static void main(String[] args) { Planet[] planets = { new Planet("Mercury",0), new Planet("Venus",0), new Planet("Earth",1), new Planet("Mars",2) }; System.out.println(planets); System.out.println(planets[2].name); System.out.println(planets[2].moons); } }

tawa_z58

Correct answer is B .name and position are directly called .

kkaayyyy

Solution is B.

iSnover

Correct is Letter B, because in the first line return with hash, but in the second and third line the object is called in the position directly, now return: Planets.Planet;hash Earth 1

gu_esposar

THE ANSWER IS B

mesonjesi

ANSWER IS B

fvelazqueznava

ANSWER IS B

Kolodets

String and int implement toString method => will be printed well. array not