0

I have been trying to parse a string from arguments, I have tried

String.parseString(args[0]);

what exactly am I doing wrong?

1
  • 3
    The arguments are already strings. Commented Nov 15, 2012 at 23:11

2 Answers 2

3

args[0] should already be a string if it's coming from command line.

If not, use String.valueOf(args[0]).

See http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/String.html

Sign up to request clarification or add additional context in comments.

1 Comment

Note that if you're trying to validate the arguments and actually get meaning out of them, you can try commons-cli instead of manually running through them.
2

As the args argument in the main method is already a String array, you can just use args[0].

There is no such method String.parseString() btw.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.