issue getting program to compile

Here is my code:

import java.util.Scanner;

publicclass Vowels

{

static Scanner console =new Scanner(System.in);

publicstaticvoid main(String[] args)

{

char ch;

System.out.print("Enter a letter of the alphabet " +

"to see if it is a vowel: ");

ch = console.next().charAt(0);

System.out.println();

System.out.println(isVowel(char ch));

}

publicstaticboolean isVowel(char ch)

{

switch (ch)

{

case'a':case'e':case'i':case'o':case'u':

case'A':case'E':case'I':case'O':case'U':

returntrue;

}

returnfalse;

}

}

When compiled I get:

C:\temp\Vowels.java:19: '.class' expected

System.out.println(isVowel(char ch));

^

C:\temp\Vowels.java:19: ')' expected

System.out.println(isVowel(char ch));

^

2 errors

Tool completed with exit code 1

[/code]

Message was edited by:

mattvgt

[2510 byte] By [mattvgta] at [2007-11-27 9:58:55]
# 1

You only specify the type of a method parameter when declaring the method, not when calling it

void foo(char ch) { /* do stuff */ } // declaration/definition

char ch = ...;

foo(ch); // calling the method

jverda at 2007-7-13 0:29:49 > top of Java-index,Java Essentials,Java Programming...
# 2
Sorry I'm not sure what you mean. Where should that be put?
mattvgta at 2007-7-13 0:29:49 > top of Java-index,Java Essentials,Java Programming...
# 3

You don't "put it" anywhere. It's not a copy/paste. It's there to show you the pattern.

Read what I wrote. Do you understand the difference between declaring (or defining) a method and calling a method?

Look at where the errors are ocurring.

Look at what you have there.

Look at my code. Notice how I showed declaring a method and calling a method. You're getting the error because you're calling the method, but the stuff you put in the parentheses is like you're declaring it. Get rid of the "char" inside the parens.

jverda at 2007-7-13 0:29:49 > top of Java-index,Java Essentials,Java Programming...
# 4
Ok, I understand now.Worked, thanks a lot.
mattvgta at 2007-7-13 0:29:49 > top of Java-index,Java Essentials,Java Programming...