Tell me more ×
Code Review Stack Exchange is a question and answer site for peer programmer code reviews. It's 100% free, no registration required.

Sorry guys i know this seems to be a complete newbie question , but i am new. I'm following online tutorials in java about "enum" And when ever i copy and paste any enum example in "eclipse",

i get this error:

"This public type enumTest must be defined in its own file"

I have tried many examples and all show this same error, what am i doing wrong ?

share|improve this question
4  
Hi, this sort of question belongs on StackOverflow (see the FAQ). Code Review is for working code. – Trevor Pilley Nov 2 '12 at 12:34
stack overflow won't let me post this question ... that's why i had to post it here :( – Sharp edge Nov 2 '12 at 12:46

closed as off topic by Trevor Pilley, codesparkle, palacsint, Donald.McLean, Brian Reichle Nov 2 '12 at 15:55

Questions on Code Review Stack Exchange are expected to relate to code review request within the scope defined in the FAQ. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about closed questions here.

1 Answer

up vote 1 down vote accepted

This question is off-topic, but I'll answer it and maybe it will be migrated to StackOverflow.

what am I doing wrong?

Exactly what the error message says:

In Java, every type has to be defined in its own file. So you need to put your enum into a new file with the name enumTest.java.

share|improve this answer
Thanks @ code sparkle ... :) It worked – Sharp edge Nov 2 '12 at 12:46

Not the answer you're looking for? Browse other questions tagged or ask your own question.