Follow Our FB Page << CircleMedia.in >> for Daily Laughter. We Post Funny, Viral, Comedy Videos, Memes, Vines...


class test
{
private static void main(String []adsf)
{

}
}

explain me that the above code is error or exception

Answers were Sorted based on User's Feedback



class test { private static void main(String []adsf) { } } explain me that the above ..

Answer / bhargava

Code will throw exception. Because usually every stand
alone program execution should start with main method. It
should be public other wise this method doesnt exposed to
out side to run.

Is This Answer Correct ?    12 Yes 0 No

class test { private static void main(String []adsf) { } } explain me that the above ..

Answer / sri

It will not generate any compile time error, but while
running the program it will generate the output as "main
method is not public".....

Is This Answer Correct ?    7 Yes 0 No

class test { private static void main(String []adsf) { } } explain me that the above ..

Answer / xavier

This will throw a runtime error stating main method not public
This is because main method is the starting point of program
execution and it should be accessible by JVM

Is This Answer Correct ?    2 Yes 0 No

Post New Answer



More Core Java Interview Questions

What are the advantages of the model over the event- inheritance model?

1 Answers  


Is integer passed by reference in java?

0 Answers  


How do I convert a numeric ip address like 192.18.97.39 into a hostname like java.sun.com?

0 Answers  


What is the difference between abstract class and interface?

3 Answers   Aspire,


Is null an object in java?

0 Answers  






Why is it called buffering?

0 Answers  


What environment variables do I need to set on my machine in order to be able to run java programs?

0 Answers  


What are the differences between forwarding () method and sendredirect() methods?

0 Answers  


What is class level lock ?

0 Answers  


Why map is used in java?

0 Answers  


Explain what are final variable in java?

0 Answers  


What are methods?

0 Answers  






Categories