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 the base class in java from which all classes are derived?

747


What is a finally block? Is there a case when finally will not execute?

761


What is the use of bufferedreader?

766


What are the data types supported by java?

758


How do you allocate memory to object?

737


Which is better singleton or static class?

710


how does multithreading take place on a computer with a single cpu? : Java thread

918


What is finalize method?

831


What is the use of singleton class?

732


Is a class an object?

788


How are this() and super() used with constructors in java programming?

782


how to create multithreaded program? : Java thread

717


What is palindrome in java?

749


What is an example of a keyword?

776


Is arraylist an object in java?

835