Skip to main content

Posts

Showing posts with the label sring []args

Why public Static void main(String args[]) in java

Well Everybody knows that java has grown exponentially .Its been used every where right from the mobile phones to the servers. It has got the largest set of libraries you can find a library for almost everything. Every one know what i've just written but very few know why always we need to write the signature of main method as above public static void main(String []args) we declare the method public because its been called by someone outside the class.That someone is JVM the java interpreter We declare the method as static because JVM has no means no instantiate a class but by the very defination of the static is that there is no need for the instantiation of a class if the class contains static methods. for calling static methods there is no need to instantiate the class we can call static methods directly by using class_name.method name it is because of this reason that we declare the method as static since JVM has no way of instantiation of a Class. void is the ret...