| Author |
enum parameter in method declaration
|
MaheshS Kumbhar
Ranch Hand
Joined: Sep 24, 2009
Posts: 188
|
|
The above code sample does not compile saying modifier enum not allowed here.
Cant we pass enum constants in method call?
|
I am slow but sure
|
 |
Maneesh Godbole
Saloon Keeper
Joined: Jul 26, 2007
Posts: 8439
|
|
enum (lower case 'e') is a keyword.
Enum (upper case 'E') is a class
Switch your code to use the class and things will work your for you.
Check out http://java.sun.com/docs/books/tutorial/java/javaOO/enum.html
|
[Donate a pint, save a life!] [How to ask questions] [Onff-turn it on!]
|
 |
Jesper de Jong
Java Cowboy
Bartender
Joined: Aug 16, 2005
Posts: 12928
|
|
Please use the code tags correctly; don't double-click the Code button, because it will open and immediately close the code block.
Yes, you can pass enum constants to methods, but you shouldn't use the 'enum' keyword in the method declaration, just like you don't use the 'class' keyword in a method declaration.
|
Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
|
 |
 |
|
|
subject: enum parameter in method declaration
|
|
|