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 is the JNDI?

3 Answers  


What restrictions are placed on method overriding in java programming?

0 Answers  


What is empty list in java?

0 Answers  


What is Major and importance difference between for and foreach loop ?

0 Answers   Infosys,


What are static initalizers in java ?

0 Answers  






Why ArrayList class is not a synchronized class and why it is not a thread safe class? explain

1 Answers  


What are thread local variables?

0 Answers  


Is null a value?

0 Answers  


what is the purpose of method overriding in java where v r completely re-defining a inherited method instead y can't v create a new method and define.If the question is very silly plz excuse me and do reply.Thank U!

7 Answers   emc2, Kumaran Systems,


can u handle an error if u write Thowable in the catch class lise try { some errorneous code }catch(Throwable e){ ...}

4 Answers  


Explain java heap space and garbage collection?

0 Answers  


What is singletonlist in java?

0 Answers  


Categories