If the class name is not same as the program file name, then what will happening?

Ans: program will be compiled, but not run. The output will not be anything.


Program:

//Define a class A
class A
{
    //define main method
    public static void main(String args[])
    {
        {
            //call print function
            System.out.println("hello init block");
        }
    }
}



Sample output: 



Post a Comment

Previous Post Next Post