---
title: "Expain the reason for each keyword of public static void main(String args[])?"  
description: "Expain the reason for each keyword of public static void main(String args[])?"  
author: "Amit Singh"  
published: 2011-05-07  
updated: 2020-09-23  
canonical: https://www.mindstick.com/interview/858/expain-the-reason-for-each-keyword-of-public-static-void-main-string-args  
category: "java"  
tags: ["java"]  
reading_time: 2 minutes  

---

# Expain the reason for each keyword of public static void main(String args[])?

**public-** main(..) is the first method called by java environment when a program is executed so it has to accessible from java environment. Hence the access specifier has to be public.

**static:** Java environment should be able to call this method without creating an instance of the class , so this method must be declared as static.

**void:** main does not return anything so the return type must be void

The argument String indicates the argument type which is given at the command line and arg is an array for string given during command line.

## Answers

### Answer by Amit Singh

**public-** main(..) is the first method called by java environment when a program is executed so it has to accessible from java environment. Hence the access specifier has to be public.

**static:** Java environment should be able to call this method without creating an instance of the class , so this method must be declared as static.

**void:** main does not return anything so the return type must be void

The argument String indicates the argument type which is given at the command line and arg is an array for string given during command line.


---

Original Source: https://www.mindstick.com/interview/858/expain-the-reason-for-each-keyword-of-public-static-void-main-string-args

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
