public class Body public long idNum public String name public Body orb

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
public class Body
{
public long idNum;
public String name;
public Body orbitis;
public static int nextID = 0;
public static final double G = 9.81;
}
Body sun = new Body();
sun.idNum = Body.nextId++;
sun.name = Sun;
sun.orbits = null;
Body earth = new Body();
earth.idNum = Body.nextId++;
earth.name = Earth;
earth.orbits = sun;