This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Beginning Java and the fly likes Getting Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Getting "Class, Interface or Enum expected" at the end of my code." Watch "Getting "Class, Interface or Enum expected" at the end of my code." New topic
Author

Getting "Class, Interface or Enum expected" at the end of my code.

Toshiro Hitsuguya
Greenhorn

Joined: May 15, 2009
Posts: 19
Hey, you guys have been extremely helpful so far.

I am having a problem getting part of my code to compile. At the very end of the code I am getting "Class, Interface, or Enum expected" at the end of my code. I tried to add another } but that didn't work. I have part of my code finished so far.




Toshiro Hitsuguya
Greenhorn

Joined: May 15, 2009
Posts: 19
Never mind just fixed it.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38431
    
  23
Well done fixing it ( ) ; I probably know what you did without even looking at your code, but for the benefit of other readers, please tell us briefly what the problem was.
Toshiro Hitsuguya
Greenhorn

Joined: May 15, 2009
Posts: 19
Sure. Thanks. It's very simple. I went through the number of } and found that I had too many. Simple error. Erased one and worked fine.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38431
    
  23
That's what I though. "class interface or enum expected" at the end of the class means too many }
The same error at the beginning of the class usually means
  • A spelling error eg Class or clas
  • Something other than package declarations or imports before the class declaration
  • A formatting error like publicclass instead of public class
  •  
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: Getting "Class, Interface or Enum expected" at the end of my code.