Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


What is the need to declare main() method as static in Java?

Answers were Sorted based on User's Feedback



What is the need to declare main() method as static in Java?..

Answer / shadab alam

static keyword specifies that there is no need of instance
to call static method and it's information is contained by
JVM that calls the static method.That's why we declare main
method as static so that it can be called automaticlly.

Is This Answer Correct ?    58 Yes 11 No

What is the need to declare main() method as static in Java?..

Answer / devender

answer is write

Is This Answer Correct ?    14 Yes 3 No

What is the need to declare main() method as static in Java?..

Answer / paletipatisrinu

public static void main(String k[]) here

public:The main method will be called by jvm.so jvm is
located some other place so invoke our main() should be public

static:before object is creation calling main() method so
the main() method will be called by using static

void:so jvm does not expected any return value
main():its method name
String[]:argument type is String

Is This Answer Correct ?    17 Yes 6 No

What is the need to declare main() method as static in Java?..

Answer / monalisa

public static void main(String[] args) means
public - is the access modifier .if we declare a method as
public means we can access the method out side of the class.
static - It is a key word.If we declare a method as static
then we can call this method with out creating any instance
of that class.Directly we can call it by "CLASSNAME.STATIC
METHOD NAME"
void - It is the return type of the method
main - It is the Method name

Is This Answer Correct ?    10 Yes 0 No

What is the need to declare main() method as static in Java?..

Answer / bsridhar1984

main() is the entry point of the java program for JVM. If it
is not static and have to call main method, JVM has to
create the object for that class. At this situation
constructor of that class will be entry point.

So that main() method of that class should be static. Then
only JVM can access the main method directly without
creating object of the program.

Is This Answer Correct ?    7 Yes 0 No

What is the need to declare main() method as static in Java?..

Answer / praveena

answer is correct

Is This Answer Correct ?    7 Yes 2 No

What is the need to declare main() method as static in Java?..

Answer / dadhich

main method is declared as static because we cannot call the method without creating the object of the class.When we declare class and in which if we define main method then it is must to use the static keyword.static keyword helps to execute the main method without instantiating the class.

Is This Answer Correct ?    5 Yes 0 No

What is the need to declare main() method as static in Java?..

Answer / kiran

yes

Is This Answer Correct ?    5 Yes 2 No

What is the need to declare main() method as static in Java?..

Answer / shivakrishna

Shadab Alam's answer is very excellent......

Is This Answer Correct ?    3 Yes 1 No

What is the need to declare main() method as static in Java?..

Answer / s. devanand

In Java, we call any method and variable without creating an
object of the class. Hence we declare main method as static
without creating an object we call the main method.

Is This Answer Correct ?    2 Yes 0 No

Post New Answer

More Java Related AllOther Interview Questions

Which version of jdk is required for netbeans 8.0 2?

0 Answers  


What's the difference between local, global and universal groups? : java security

0 Answers  


What is java web application?

0 Answers  


Why do we need new date and time api in java se 8?

0 Answers  


Is java installed on windows 10?

0 Answers  


What is jpa project?

0 Answers  


What is the content reside in Use case Document?

0 Answers  


How do you find lambda?

0 Answers  


Java prints out a ton of digits when I system.out.println() a double. How can I format it so it displays only 3 digits after the decimal place?

0 Answers  


What is microservices java?

0 Answers  


I have deployed a .war file in my application server comprising of struts and hibernate.If i want to change the "dialect" property of hibernate cfg file how can i change(I have only .war file)... Thanks in advance

0 Answers  


Are jvm’s platform independent?

0 Answers  


Categories