Ask Experts Questions for FREE Help!
  Advanced
Register  |  Log in  
   Ask    
 Answer  
  Help  

Ask QuestionsprogressAnswer QuestionsprogressBuild ReputationprogressBecome an Expert
 
Free Answers in 3 Easy Steps

Register Now
3 Steps

At Ask Me Help Desk you can ask questions in any topic and have them answered for free by our experts. To ask questions or participate in answering them you must register for a free account. By registering you will be able to:
  • Get free answers from experts in any of our 300+ topics.
  • Accept money for answers that you provide.
  • Communicate privately with other members (PM).
  • See fewer ads.

Home > Computers & Technology > Programming > Compiled Languages > Java   »   Why main() in java is declared as public static void main?

 
Question Tools Search this Question Display Modes
Question
 
 
#1  
Old Jul 17, 2008, 11:51 AM
priyankadandeka
New Member
priyankadandeka is offline
 
Join Date: Jul 2008
Posts: 5
priyankadandeka See this member's comment history on his/her Profile page.
Why main() in java is declared as public static void main?

This question was asked to my friend in here interview.

I am looking for a well organized answer on this question, can someone help.

Reply With Quote
 
     

Answers
 
 
Old Jul 17, 2008, 11:53 AM   #2  
joshisachin79
New Member
joshisachin79 is offline
 
Join Date: Jul 2008
Posts: 13
joshisachin79 See this member's comment history on his/her Profile page.
Public - main method is called by JVM to run the method which is outside the scope of project therefore the access specifier has to be public to permit call from anywhere outside the application

static - When the JVM makes are call to the main method there is not object existing for the class being called therefore it has to have static method to allow invocation from class.

void - Java is platform independant language therefore if it will return some value then the value may mean different to different platforms so unlike C it can not assume a behavior of returning value to the operating system.

Read more about Java Fundamental Questions here : Java Fundamental Questions
  Reply With Quote
 
     


Question Tools Search this Question
Search this Question:

Advanced Search
Display Modes

 
Similar Sponsors

Similar Questions
Question Asker Topic Answers Last Post
Java Virtual Machine Launcher - Could not find the main class cool_thanx Computers for Beginners 1 Jun 3, 2008 10:12 PM
Load Center Main Lug or Main Breaker for the Attic abcsalem Electrical & Lighting 5 Feb 5, 2008 06:34 AM
Can I convert a main breaker Cutler Hammer loadcenter to main lug? coyote556 Electrical & Lighting 1 Aug 3, 2007 12:41 PM
Difference between Main Lug and Main Breaker Panel Hoot01 Electrical & Lighting 5 Jan 22, 2007 01:46 AM
Java: using an array from the main in a method kilroy Internet & the Web 2 Jul 30, 2003 11:37 AM




Copyright ©2003 - 2007, Ask Me Help Desk.
All times are GMT -8. The time now is 05:40 PM.

Content Relevant URLs by vBSEO 3.0.0 RC6 © 2006, Crawlability, Inc.