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 you sort a string in java?

709


What is difference between array and arraylist in java?

753


Where can i get Latest SUN Certification Dumps and what are the Sun Certification Codes that are available, Im new to JAVA, so please gimme info as i need to write J2EE - Core Java Certification

1658


How java enabled high performance?

840


What is the access scope of a protected method?

778


How do you end a program?

792


What are the different http methods?

774


Can we have more than one package statement in the source file?

893


What is default constructors?

768


Explain about join() method?

764


What methodology can be employed to locate substrings inside a string?

760


I want my class to be developed in such a way that no other class (even derived class) can create its objects. Define how can I do so?

945


What are void pointers?

1025


What is nextline method in java?

824


What are the differences between Java 1.0 and Java 2.0?

1950