Please explain me the "Error: Class, interface or enum expected "

This occurs in Java and this is happening for very long time which is getting on my nerves. Give me the solution along with some examples by explaining what is class, interface and enum.

21st Jan 2023, 3:12 PM
Shubham Sonawane
5 Answers
+ 5
Imagine poor Java, it's telling you it wants/expects one of these things and you insist on not providing it in the code. Look at your code and see if you are using any of these things. If you don't know what they are, you should complete the Java course, or take it again.
21st Jan 2023, 5:23 PM
Ausgrindtube - avatar
+ 4
If you need help with your code, please link your code so we can have a look at it.
21st Jan 2023, 3:16 PM
Lisa - avatar
+ 3
Shubham Sonawane If you don't know what I am talking about. Start a new Java code bit and you will see that everything of the starter code is contained by the class. There are a few things that will be outside a class (or interface or enum) body. Eg: import somepackage;
21st Jan 2023, 5:56 PM
Lochard - avatar
+ 2
Do you have some code that should be inside a class not contained by a class (or interface or enum)?
21st Jan 2023, 4:43 PM
Lochard - avatar
+ 1
Ausgrindtube okay
21st Jan 2023, 5:33 PM
Shubham Sonawane