Uncategorized – Learn & Share http://zulkifliishak.com A blog where I learn and Share Mon, 16 Jul 2018 12:17:08 +0000 en-US hourly 1 https://wordpress.org/?v=6.5.2 149499638 public static void main(String[] args) explaination http://zulkifliishak.com/public-static-void-mainstring-args-explaination/ Mon, 16 Jul 2018 12:17:08 +0000 http://zulkifliishak.com/?p=36 The

public static void main(String[] args) // starting a program in Java

is one of the strange line for Java beginners. It automatically trigger a question, why its like that. Compared to

 void main() // starting a program in C

in C which are much simpler.

So what does it means?

First of all lets go back to main, and void main.

Main is basically the entry point of the program. The main program then can invoke any other function.

void means the main program returns nothing to the operating system.

So what is public and static for in Java?

Public – Public is to declare that the method main is a public method.  Main method must be public so that Java Virtual machine can find the main method.

 

]]>
36