Class or Interface excepted [closed]
Class or Interface excepted [closed]
Here is the code:
public class Tuna
public void eat()
System.out.println("I am a tuna fish"); // Here it says class or interface excepted
I have a Tuna class above that has a eat method. In that eat method, it says class or interface expected at the print line. Even though it is running smoothly, when I hover over the print line in the eat method it says class or interface expected. I already checked other questions related to it but I couldn't solve it. Any help is appreciated.
eat

This question appears to be off-topic. The users who voted to close gave this specific reason:
@Guy I restarted the IDE, but it still shows the same error.
– Hemlata
Sep 2 at 9:01
If just restarting does not help, you can also try File > Invalidate Caches / Restart > Invalidate and Restart. This usually fixes these kinds of problems.
– Leon
Sep 2 at 9:02
@Leon Thank you so much! It did made the error disappear.
– Hemlata
Sep 2 at 9:06
If it can run you don't have any errors. Restart the IDE, it should make the error disappear.
– Guy
Sep 2 at 8:56