java error

i am a beginner while i run a java code or even when i upload it as a file i am getting a comiple error

Main.java:3: error: class ClassName is public, should be declared in a file named ClassName.java
public class ClassName{

Even though i have named the file as ClassName.java and its running in eclipse successfully

kindly help me

In the first line, it should be

public class Main

Remove public before class keyword.

Vivek


Fdyuuu%%*## ggf###

Click to view

fhgddfh##

@

//