GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

GeekInterview.com  >  Interview Questions  >  J2EE  >  Java
Go To First  |  Previous Question  |  Next Question 
 Java  |  Question 874 of 923    Print  
If we declare main method as private instead of public, Will it execute or not.

  
Total Answers and Comments: 5 Last Update: August 16, 2007     Asked by: rajesh.tripathi 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
July 18, 2007 08:45:59   #1  
Vipul        

RE: If we declare main method as private instead of pu...
It gives java.lang.class not found errror.
 
Is this answer useful? Yes | No
July 23, 2007 13:28:09   #2  
kARUNA        

RE: If we declare main method as private instead of pu...

If you declare main() as private insted of public, we can compile the program but we cannot get the output.


 
Is this answer useful? Yes | No
July 24, 2007 08:05:23   #3  
qazianis303 Member Since: June 2007   Contribution: 2    

RE: If we declare main method as private instead of pu...

it will compile but it wont run it will give an error saying main method not public


 
Is this answer useful? Yes | No
August 11, 2007 01:32:08   #4  
sujatham Member Since: January 2006   Contribution: 142    

RE: If we declare main method as private instead of pu...
It will compliles fine.But runtime error will occur.
 
Is this answer useful? Yes | No
August 16, 2007 05:27:58   #5  
kiran        

RE: If we declare main method as private instead of pu...

There is no exception

In Java the compiler compiles the programe but whenever we execute that we wont get any output because of access specifier PRIVATE. The main method does not not call the member function (methods)


 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 




About Us  |   Privacy Policy  |   Terms and Conditions  |   Contact  |   Site Map  |   Add Question  |   Propose Category  |   RSS Feeds  |   Articles Sitemap  |   Site Updates  |   Add Resource

Copyright © 2005 - 2008 GeekInterview.com. All Rights Reserved
Page copy protected against web site content infringement by Copyscape