Why to give the file name same as the public class name in
java?

Answer Posted / mahesh

First of all, it only has to be the same when the class is
public. And there is no explicit reason for that, it's just
a convention that came along with old versions of java and
people got used to it... They say it's because of the
limited capabilities of the compiler to compile
dependencies.

Is This Answer Correct ?    9 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is __ init __ functions?

540


What is an infinite loop in java? Explain with an example.

582


what is mutual exclusion? How can you take care of mutual exclusion using java threads? : Java thread

672


How do you ensure that n threads can access n resources without deadlock?

804


What is difference between stringbuffer and string?

487






Objects or references which of them gets garbage collected?

529


How do you compare values in java?

536


How many ways can you break a singleton class in java?

481


What is the importance of hashcode() and equals() methods?

573


What is a treeset in java?

542


What is oops in java?

561


Explain the advantages of packages in java?

513


What is a default constructor and also define copy contrucyor?

593


What is a class instance variable?

614


How many types of flags are there?

519