class A
{
class B
{
psvm(String args[])
{
}
}
}
if the prg saved in A.java whats the o/p?

Answer Posted / sivadasan

The above code will be compiled succcessfully.

but at runtime it will throw an exception :

Exception in thread "main" java.lang.NoSuchMethodError: main

Because, Java Environment starts its execution from main
method. That method must be declared in the class which is
we are using to save our code.

If any query let me know....

Is This Answer Correct ?    2 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can a class have a static inner class?

600


Outline the major features of java.

561


What is percentage in java?

565


What environment variables are required to be set on a machine in order to run Java programs?

612


How many decimal digits is 64 bit?

525






What do you mean by an interface in java?

562


What are java threads?

612


What is a conditional statement explain with example?

536


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

572


Can constructor be protected in java?

499


What is boolean query?

524


What are multiple inheritances? Is it supported by java?

456


I have multiple constructors defined in a class. Is it possible to call a constructor from another constructor’s body?

583


How do you declare a destructor in java?

496


When the constructor of a class is invoked?

582