R
Razvan
Hi !
"Java classes are always defined inside a single source code file."
I have found the above afirmation in the book "Java 2 programmer Exam
Cram 2 (310-035)". However I am able to do something like this in a
single file:
public class CTest
{
public static void main( String[] args ) throws Exception
{
System.out.println("This is CTest !");
}
}
class Mebo {
public static void main( String[] args )
{
System.out.println("This is MEBO !");
}
}
Pay attention: the class Mebo is not public (it has package access).
However, after compilation I have 2 classes:
CTest.class
Mebo.class
and there is not problem running any of them.
Question: Is this the normal behaviour or it is just my
implementation that allows this ?
Since I am using Sun's compiler and JVM I doubt that they do not obey
their own standard.
Regards,
Razvan
"Java classes are always defined inside a single source code file."
I have found the above afirmation in the book "Java 2 programmer Exam
Cram 2 (310-035)". However I am able to do something like this in a
single file:
public class CTest
{
public static void main( String[] args ) throws Exception
{
System.out.println("This is CTest !");
}
}
class Mebo {
public static void main( String[] args )
{
System.out.println("This is MEBO !");
}
}
Pay attention: the class Mebo is not public (it has package access).
However, after compilation I have 2 classes:
CTest.class
Mebo.class
and there is not problem running any of them.
Question: Is this the normal behaviour or it is just my
implementation that allows this ?
Since I am using Sun's compiler and JVM I doubt that they do not obey
their own standard.
Regards,
Razvan