How do I get the available font family names?

package org.kodejava.example.awt;

import java.awt.Font;
import java.awt.GraphicsEnvironment;

public class FontFamilyNameList {
    public static void main(String[] args) {
        // Get all available font family names from GraphicsEnvironment
        GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
        String familyNames[] = ge.getAvailableFontFamilyNames();

        // Iterates familyNames array to display the available font's family names
        for (String familyName : familyNames) {
            System.out.println("Family names: " + familyName);
        }        
    }
}

How do I get the available font names?

package org.kodejava.example.awt;

import java.awt.Font;
import java.awt.GraphicsEnvironment;

public class FontNameList {
    public static void main(String[] args) {
        // Get all available fonts from GraphicsEnvironment
        GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
        Font[] fonts = ge.getAllFonts();

        // Iterates all available fonts and get their name and family name
        for (Font font : fonts) {
            String fontName = font.getName();
            String familyName = font.getFamily();

            System.out.println("Font: " + fontName + "; family: " + familyName);
        }
    }
}