0

[DUPLICATE] What does means (String[ ] args) ? Could you give a example?

class MyClass { public static void main(String[ ] args) { //Whats does It means? (String[ ] args) - It is a keyword in Java? Vehicle v1 = new Vehicle(); Vehicle v2 = new Vehicle(); v1.color = "red"; v2.horn(); } } Thanks any explanation

16th Jan 2018, 3:06 PM
Pedro Hartmann
Pedro Hartmann - avatar
1 Answer
+ 6
Actually every input in java is accepted as string . This method is called as accept input using command line argument. Then you have to parse(change data type) it to required data type. Hence String args[] is used to accept input. https://stackoverflow.com/questions/890966/what-is-string-args-parameter-in-main-method-java You may refer this link.
16th Jan 2018, 3:09 PM
Hrishikesh Kulkarni
Hrishikesh Kulkarni - avatar