Skip to main content

Source File introduction


Source File Structure:
1.  A Java Program contains any number of classes.
2. Atleast one class can be declared as public.
3. More than one public class is not allowed.
4.  If name of the class has public then it is must be matched with SourceFile name(if not means error).

Simple program 1: 

A.java  // SourceFile Name

public class A
{
}
class B
{
}
5.if there is no public class, we can use any class name as Source file name


*Note: More than one public class is not allowed

Simple program 2: 

A.java  // SourceFile Name

class A
{
}
class B
{
}



Comments