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

What are the types of java languages?

0 Answers  


What does the “static” keyword mean?

0 Answers  


Why are arrays useful in java?

0 Answers  


Can we make constructors static?

0 Answers  


how to split string in java?

0 Answers  






java Technical questions asked by JPMC

0 Answers   JPMorgan Chase,


Can we extend singleton class in java?

0 Answers  


Is there a case when finally will not execute?

0 Answers  


What are the characteristics of Final,Finally and Finalize keywords.

0 Answers   Flextronics,


Why do we need hashmap in java?

0 Answers  


What do you mean by ordered and sorted in collections in java?

0 Answers  


Can you instantiate the math class?

0 Answers  


Categories