Question: I am trying to learn Java now and this is the hello world program and it already have started to baffle me. I am used to python and I found [this](http://qatar.cmu.edu/~dfossati/15-121-spring12/resources/Java4Python.pdf) tutorial (ebook) simple and concise for programmers who have python background. 

Hello world program in Java from the book:

```
public class Hello {

public static void main (String[] args) {

     System.out.println("Hello World!");
}
}

```

As the book says, the equivalent code for this in python is:

```
class Hello(object):
  @staticmethod
  def main(args):
     print "Hello World!"

```

I completely understand the python code. However, I have a problem with Java code and I want to be clear before I proceed further so that I get the root knowledge of language in my brain.

The book says (as copied from book):

> 
> ...we have one parameter. The name of the parameter is args however,
>  because everything in Java must have a type we also have to tell the
>  compiler that the value of args is an array of strings. For the moment
>  You can just think of an array as being the same thing as a list in
>  Python. The practical benefitt of declaring that the method main must
>  accept one parameter and the parameter must be a an array of strings
>  is that if you call main somewhere else in your code and and pass it
>  an array of integers or even a single string, the compiler will flag
>  it as an error.
> 
> 
> 

This does not make any sense to me. Why can I not pass anything since my function doesn't require anything? What happens if I just pass (String args).

Since I am completely newbie to Java, please bear with me.

Answer: 
Well, you are passing in something. Whenever you run a java program, command line arguments are passed in as the `args` argument, so you need to accept those, even if you don't use them.
In Java, there is no top-level code as in Python (i.e. there is no direct equivalent to just

```
print('Hello world')

```

). Nevertheless, a Java program needs some kind of entry point so that it can start executing code. Like many other languages (i.e. C/C++, C#, Haskell), a [function with the name `main`](http://en.wikipedia.org/wiki/Main_function_(programming)) serves for this purpose and is called by the runtime (i.e. Java interpreter).

When calling the `main` function, the runtime uses a [certain number (and types) of arguments](http://en.wikipedia.org/wiki/Function_signature#Signature). The function must match these. You're free to then call other methods with any signature you like:

```
public class Hello {
  public static void hi() {
    System.out.println("Hello World!");
  }
  public static void main (String[] args) {
    hi();
  }
}

```