How are Java source code files named?

Answers were Sorted based on User's Feedback



How are Java source code files named?..

Answer / niranjanravi

A java source code file contains atmost one public class
or interface defined with in the file.Java source code
files takes the name of the public class or interface that
is defined with in the source code file.If no public class
or interface is defined with in the source code file then
file must take on a name that is different than its public
class or interface.

Is This Answer Correct ?    2 Yes 0 No

How are Java source code files named?..

Answer / ravikiran(aptech mumbai)

java source code names will be named withthe name of the
class that is declare as publicwith .java extension

Is This Answer Correct ?    1 Yes 0 No

How are Java source code files named?..

Answer / vijayakumar chinnasamy

If a java source code file contain public class then the
source code file name should be public class name other
wise compiler error.


if a java source code does not contain the public class
then the name may be class name or anything ,not a problem.

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More Core Java Interview Questions

How many methods does cloneable interface contains?

6 Answers  


What is the difference between actual and formal parameters?

0 Answers  


When super keyword is used?

0 Answers  


What is the primary benefit of encapsulation?

0 Answers  


What does a za z0 9 mean?

0 Answers  






Why is inheritance used in java?

0 Answers  


Can an interface be final?

0 Answers  


What is close method? How it's different from Finalize & Dispose?

0 Answers   InfoAxon Technologies,


What is the use of private static?

0 Answers  


What is the purpose of declaring a variable as final?

0 Answers  


What is the difference between parameters and arguments ?

2 Answers  


Is intellij better than eclipse?

0 Answers  


Categories