could you run the java program without main method?

Answer Posted / naga

yes,we can write and run a java program without using the
main method.
i.e By using static

example program...!

public void static( )
public class
{
public void static( )
{
System.out.println( "Without main method" );
System.exit(0);
}
}

Is This Answer Correct ?    23 Yes 22 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Compare java and python.

761


Which is better singleton or static class?

704


Can subclass overriding method declare an exception if parent class method doesn't throw an exception?

754


What is the syntax and characteristics of a lambda expression? Explain

791


Can we catch more than one exception in a single catch block?

841


What does a boolean method return?

873


What are static blocks and static initalizers in java ?

777


What do you understand by private, protected and public?

740


What happens if main method is not static?

722


Difference between final and effectively final ? Why is effectively final even required ?

753


What are loops in java?

786


Explain about core java?

860


What is singleton service?

715


What is the purpose class.forname method?

747


From the two, which would be easier to write: synchronization code for ten threads or two threads?

819