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

Explain restrictions on using enum?

0 Answers  


What is basic syntax?

0 Answers  


What is the instance of an object?

0 Answers  


Explain the difference between runnable and callable interface in java?

0 Answers  


What are inbuilt functions?

0 Answers  


What is deserialization?

0 Answers  


What is Overriding and how can it be used?

7 Answers   Consagous, Wipro,


List some features of the abstract class.

0 Answers  


What are parsers? Dom vs sax parser.

0 Answers  


how to write a program for sending mails between client and server

0 Answers   Lampex,


what is polymorhism what is inheritance? what is Abstract n Interface? what if two interfaces have same method and a concrete class is implementing both the interfaces. Will there be a compilation error? What are mutable and immutable classes? How can u make a class mutable? when will u use dem ...explain with example? what is overriding and overloading? what is garbage collection? what is Thread? how do dey communicate? what are the different ways of implementing ? have u used any messaging technologies? what is synchronization? what are some additions in java 1.5? what are generics? whst is advanced for loop? what is finally block? can u have a try in finally? yes!! can u have a finally in finally? how do you write junits? when is a object eligible for garbage collection?explain? a = null and b has ref to a will b be eligible to be garbage collected? sql questions like diff joins? how do dey work? exception handling? what is marker interface? what is the need??

0 Answers   JPMorgan Chase,


Is int a class in java?

0 Answers  


Categories