Why do we write String args[] in main of the program?

Showing Answers 1 - 21 of 21 Answers

anshul

  • Oct 24th, 2012
 

I know very well that string data can be converted to any data but the question is what is the need of it. If we don't write it why it gives us error?

  Was this answer useful?  Yes

Varu

  • Oct 26th, 2012
 

It gives error because JVM is hard coded to search for the main method in that pattern only.

  Was this answer useful?  Yes

For example if two persons are taking and interacting each other means they were understanding their expressions or feeling through one language...In the same way if JVM wants to know from where exactly the program needs to be start for that we are giving one patter of method to JVM saying like plz search for a main method with this pattern i.e public static void main(String args[]) {...}. When the JVM starts it search for this main method from there it starts executing the program. If the JVM didt get this method it throws a Runtime Exception..

Gajavelli shiva krishna

  • Jul 18th, 2013
 

We write in string args[] in main in Java because string args[] means it allows string of array objects

  Was this answer useful?  Yes

muskan

  • Jul 29th, 2013
 

we have to write String args[] in main to run a program, because JVM(java virtual machine) can only recognize the main with string array as parameter, as starting method or a point.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions