This post originated from an RSS feed registered with Java Buzz
by Arpit Mandliya.
Original Post: How to fix class interface or enum expected error in java
Feed Title: Java tutorial for beginners
Feed URL: http://feeds.feedburner.com/arpitmandliyasblog
Feed Description: A blog about java programming language and its frameworks
In this post, we will see how to fix “class interface or enum expected” error in java. There can be multiple reason for getting this error. Due to method outside class body This error you will generally get when you have accidentally put your method outside class body. Let’s see with the help of simple example. You will get below error when you run javac command. $javac MyClass.java MyClass.java:7: error: class, interface, or enum expected public static void myMethod() ^ MyClass.java:10: error: class, interface, or enum expected } ^ 2 errors But if you use eclipse ide, you will