In Java why we write public static void main(String args[])
why not main()?
Answer Posted / marrapu venkatesh.
Public: the reason for using public is to be accessed by the jvm. if u write private it should not be recognized by the jvm to execute. public methods accessed out of the class that's why we write public.
Static: the reason for static is when the program execution start main method should be invoked first. static method is called first. because we cant create object to main class to call methods. that's why we write static.
Void: In java main function does not return any value.
Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
Hi.... I applied for the post of scientific officer/Engineer-SB(Programmer).Please post the syllabus and sample papers.
How to avoid memory leak in java?
What is externalizable interface?
Is hashset ordered java?
What is a conditional equation?
What is the use of list in java?
Why do we declare a class static?
How to make a write-only class in java?
Given a singly linked list, determine whether it contains a loop or not without using temporary space?
Can we override compareto method?
What are peerless components in java programming?
What is the use of singleton class?
What are variable names?
What is the meaning of immutable regarding string?
Difference between a class and an object?