Why Is My Java File Looks Strange in Eclipse?

It's related to how Package Explorer is showing the project content. The second one (solid blue J icon) shows Java source code while the first one shows just a folder structure with any files in it (Java files in this case). Meaning that if you fail to see the second one then your project is in trouble since there's no source code folder configured.

You could check you project sources by right click on project > Java Build Path > Source

If you want to avoid confusion then I'd recommend to use the Navigator view over the Package Explorer view cause the former shows your folder structure as it is w/o any modifications.

Tags:

Java

Eclipse