Loop round and remove the consonants
So it looks like you're just printing out the vowels in your string, right?

System.out.println(answer.replaceAll("[^AaeEiIoOuU]", ""));


Removes the for loop and compacts your code a lot, making it a lot more readable IMO.  Also notice how easy it was for me to extend to capital letters.



It would be good to note that this is a replacement for your block of code as it is right now.  If you plan on printing the vowels in a variable amount of strings (perhaps input by the user), then you would want to make a method that would do this for you.  In this function you would pass in the precompiled regex and the string to print.

I wrote this up really quick in a text editor and didn't compile it, but here is a program that could handle multiple strings better:

class VowelPrinter
{
    static final Pattern p = Pattern.compile("[^AaeEiIoOuU]");

    public static String removePattern(Pattern p, String str)
    {
        return p.matcher(str).replaceAll("");
    }
    public static void main (String[] args)
    {
        int num = 0;

        System.out.print("How many names are you going to save: ");
        Scanner in = new Scanner(System.in);
        num = Integer.parseInt(in.nextLine().trim());

        String names[] = new String[num];
        for (int i = 0; i &lt; names.length; i++)
        {
            System.out.print("Type a name: ");
            names[i] = removePattern(p, in.nextLine());
        }
        System.out.println("Names with consonants removed:");
        for (int i = 0; i &lt; names.length; i++)
        {
            System.out.println(names[i]);
        }
    }
}