forked from AllenDowney/ThinkJavaCode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlanetTester.java
More file actions
32 lines (29 loc) · 926 Bytes
/
PlanetTester.java
File metadata and controls
32 lines (29 loc) · 926 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
public class PlanetTester
{
public static void main(String[] args)
{
Planet planet1 = new Planet("Mercury");
Planet planet2 = new Planet("Venus");
Planet planet3 = new Planet("Earth");
Planet planet4 = new Planet("Mars");
Planet planet5 = new Planet("Jupiter");
Planet planet6 = new Planet("Saturn");
Planet planet7 = new Planet("Uranus");
Planet planet8 = new Planet("Neptune");
Planet planet9 = new Planet("Pluto");
Planet[] planets = new Planet[9];
planets[0] = planet1;
planets[1] = planet2;
planets[2] = planet3;
planets[3] = planet4;
planets[4] = planet5;
planets[5] = planet6;
planets[6] = planet7;
planets[7] = planet8;
planets[8] = planet9;
for(Planet planet:planets)
{
System.out.println(planet.getName());
}
}
}