0
 class Student{
    public **static** void main (String[]arg){
    }
    }

Here why we are using static keyword to start a main method. From my knowledge I can say

Static will get memory and it can retain its value Is that only reason for using Static key work in main. Explain in detail thanks

.

  • http://stackoverflow.com/questions/146576/why-is-the-java-main-method-static check this link – Sourav Kanta Jun 28 '15 at 19:09
  • Note that the meaning of `static` in Java is different from the multiple meanings that it has in C and C++. In particular, "Static will get memory and it can retain its value" - this is not what `static` means in Java. – Jesper Jun 28 '15 at 19:11
  • My question is why the compiler searches for static initially followed my void and main to start a program. – Jaga Dish Jun 28 '15 at 19:13

0 Answers0