import java.util.*;

import java.util.ListIterator;
import java.util.Iterator;
import java.util.ArrayList;

import javax.swing.JOptionPane;

public class GezegenlerVeaylarListesi {
  static class Gezegen {
    private String isim;
    private int aySayisi;
    Gezegen (String s, int aylar) {
      isim = s;
      aySayisi = aylar;
    }
    public String toString() {
      return getClass().getName() + "[" + isim + "-" + aySayisi + "]";
    }
    public final String getName() {
      return isim;
    }
    public final int getaySayisi () {
      return aySayisi;
    }
  }
  public static void main (String args[]) {
    String names[] = {"Mercür", "Venüs", "Dünya",
      "Mars", "Jupiter", "Satürn", "Uranüs",
      "Neptün", "Pluto"};
    int aylar[] = {0, 0, 1, 2, 16, 18, 17, 8, 1};
    int namesLen = names.length;
    List Gezegens = new ArrayList (namesLen);
    for (int i=0; i < namesLen; i++) {
      Gezegens.add (new Gezegen (names[i], aylar[i]));
    }
    String ss="";
    for (int i=Gezegens.size()-1; i >= 0; --i)
    {
      Gezegen p = (Gezegen)(Gezegens.get (i));

      ss+=p.getName() + " : " + p.getaySayisi()+"\n";
    }
    JOptionPane.showMessageDialog(null,ss);
    System.exit(0);
  }
}
