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

What is xslt in java?

618


How objects of a class are created if no constructor is defined in the class?

669


how to create multithreaded program? Explain different ways of using thread? : Java thread

619


What is the use of generics? When was it added to the Java development Kit?

630


What is passing by reference in java?

630






What is pangram in java?

615


How does indexof work?

609


How are java objects passed to a method and what are native methods?

686


Assume a thread has lock on it, calling sleep() method on that thread will release the lock?

738


What is stack example?

647


why doesn't java run on all platforms?

660


Is static a singleton?

623


Is Java a dying language?

674


How variables are declared?

617


Is string is a class in java?

609