top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration

Facebook Login
Site Registration

How to use string args in java?

+1 vote
83 views

Explain with an example?

posted Jan 20, 2016 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote

In Java args contains the supplied command-line arguments as an array of String objects .
If you wanted to output the contents of args, you can just loop through them like this .

Example:

public class ArgumentExample
{
public static void main(String[] args)
{
for(int i = 0; i < args.length; i++)
{
System.out.println(args[i]);
}
}
}

answer Jan 20, 2016 by Abhishek Maheshwari
Similar Questions
+2 votes

I want to convert a string say "98989" into an integer without using any library functions in java. Give fastest way to do it and explain why your method is best.

Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Bangalore-560102
Karnataka INDIA.
QUERY HOME
...