top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How to use string args in java?

+1 vote
369 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.

...