When packages are stored in a file system (�7.2.1), the host system may choose to enforce the restriction that it is a compile-time error if a type is not found in a file under a name composed of the type name plus an extension (such as .java or .jav) if either of the following is true:
The type is referred to by code in other compilation units of the package in which the type is declared. The type is declared public (and therefore is potentially accessible from code in other packages). This restriction implies that there must be at most one such type per compilation unit.
...
When packages are stored in a database (�7.2.2), the host system must not impose such restrictions.
"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
Originally posted by Laurie carrera:
... True/false?
"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
Originally posted by marc weber:
... A .java file can contain at most one public class or interface definition. If the file includes a public class or interface definition, then the name of the .java file must exactly match the name of that public class or interface.
Note that a .java file is not required to contain any public class or interface definitions, and can contain an unlimited number of non-public class or interface definitions...
"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
Originally posted by Abhijit Kolhatkar:
To extend the question:
I think, if we are declaring any interface/class, it is not mandetory that the file name of the .java file should match the class/interface name.
I.e. for the interface drivable, the name can be MyInterface.java. (we keep the name of the .java file and class inside it same for our convinience and to streamline the coding methodology)
Are there any exceptions to this?
I.e. are there any situations when it is enforced that the name of the .java file should exactly match the name of the class/interface in it? I think not...
Thanks in advance.
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Don't get me started about those stupid light bulbs. |