IS it Compulsory that a class name is same as file name in java?

Answer Posted / anuj sharma

No its not compulsory.
when you will compile the program then u will have the need
of java file that would be the naem of your .java file but
when u will run then after compilation .class will be
generate with same naem whatever you gave the class name in
java program. So no need to give the same name always.
its upto you coz its just a good practice purpose that we
usually give the same name of java file as our class name
with Iitial charater as Capital.

Is This Answer Correct ?    5 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to add flash or *.gif file in edit panel in java?

1957