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);
}
}
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
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
MPignaProTech
2 months, 2 weeks agodiptimayee
3 months agoMPignaProTech
3 months agogu_esposar
10 months, 1 week agomesonjesi
1 year, 2 months agofvelazqueznava
1 year, 3 months agoKolodets
1 year, 8 months agoVicky_65
1 year, 9 months agotawa_z58
1 year, 11 months agohaisaco
2 years agoakbiyik
2 years, 1 month agomorgan3987
2 years, 2 months agocarloswork
2 years, 2 months agokkaayyyy
2 years, 3 months agoiSnover
2 years, 3 months agoshivkumarx
2 years, 4 months agoshivkumarx
2 years, 3 months ago