Java Method Help

Hello,

I keep getting an error for the isVowel method that class, iterface or enum expected. Can someone please help.

import javax.swing.*;

publicclass Vowels

{

static String name;

staticint numberOfCharacters;

staticint vowelCount = 0;

staticint i;

staticchar letter;

publicstaticvoid main (String[] args)

{

name = JOptionPane.showInputDialog(null,"What is your name?");

numberOfCharacters = name.length();

for (int i = 0; i < numberOfCharacters; i++)

{

if (isVowel() ==true)

vowelCount++;

}

JOptionPane.showMessageDialog(vowelCount);

}

}

publicstaticboolean isVowel()

{

letter = name.charAt(i);

if (letter =='a' || letter =='A' ||

letter =='e' || letter =='E' ||

letter =='i' || letter =='I' ||

letter =='o' || letter =='O' ||

letter =='u' || letter =='U'

)

returntrue;

returnfalse;

}

[2427 byte] By [freddie_javaa] at [2007-11-27 6:37:13]
# 1
Put the isVowel method into your class definition, i.e. move the '}' right above isVowel below the currently last '}'.
thomas.behra at 2007-7-12 18:05:33 > top of Java-index,Java Essentials,New To Java...
# 2
you re-declare i locally in the for loopGenerally, it should be:if (isVowel(name.charAt(i)))...public static boolean isVowel(char letter)
bsampieria at 2007-7-12 18:05:33 > top of Java-index,Java Essentials,New To Java...
# 3
wow thanks to both you guys
freddie_javaa at 2007-7-12 18:05:33 > top of Java-index,Java Essentials,New To Java...