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
What is xslt in java?
How objects of a class are created if no constructor is defined in the class?
how to create multithreaded program? Explain different ways of using thread? : Java thread
What is the use of generics? When was it added to the Java development Kit?
What is passing by reference in java?
What is pangram in java?
How does indexof work?
How are java objects passed to a method and what are native methods?
Assume a thread has lock on it, calling sleep() method on that thread will release the lock?
What is stack example?
why doesn't java run on all platforms?
Is static a singleton?
Is Java a dying language?
How variables are declared?
Is string is a class in java?