why string is used in main function parameters | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

why string is used in main function parameters

public static void main( String[] at)

29th Jul 2016, 9:34 PM
Pankaj Sharma
Pankaj Sharma - avatar
3 Answers
0
"Strings, which are widely used in Javaprogramming, are a sequence of characters. In the Java programming language, strings are objects. TheJava platform provides the Stringclass to create and manipulatestrings." (google) its hard to explain in my own words
29th Jul 2016, 9:44 PM
Aquarius
Aquarius - avatar
0
To accept arguments from the command line. If you ran your program in CMD for example, you'd do javac Program.java, then java Program "Turtle" To call the string in your program, you just use the parameter name and index. public static void main(String[] parameters) System.out.println(parameters[0]); Normally they are called args in main method just fyi.
30th Jul 2016, 12:47 AM
James
James - avatar
0
to read the command line arguments
30th Jul 2016, 1:30 AM
Ravi Teja
Ravi Teja - avatar