Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.help > #941

Re: Q) Parsing Command-Line Arguments

From Lew <lewbloch@gmail.com>
Newsgroups comp.lang.java.help
Subject Re: Q) Parsing Command-Line Arguments
Date 2011-08-10 10:10 -0700
Organization http://groups.google.com
Message-ID <f6918113-1038-4e60-aeef-485de4fc661d@glegroupsg2000goo.googlegroups.com> (permalink)
References <6af59288-146e-46ae-8ec9-e5fab5b9f27c@y16g2000yqh.googlegroups.com>

Show all headers | View raw


Proud Japanese wrote:
> I see that there are two ways to parse command line arguments. 

What you present has nothing to do with the command line.

> For example,
> 
>         double d1 = Double.valueOf(args[0]).doubleValue() ;
>         double d2 = Double.parseDouble(args[0]);
> 
> Is there a difference between these two options?  Personally I think
> that the second option is simpler.
> 
> Which one is more preferable?

See markspaces' answer for one way to distinguish.

> Do both of these options [i.e. Type.valueOf(args[i]).TypeValue()  &
> Type.parseType(args[i])] work with all of Java's eight basic data
> types [i.e.character, boolean, byte, short, integer, long, float &
> double]

Get to know the API docs.
http://download.oracle.com/javase/7/docs/api/

-- 
Lew

Back to comp.lang.java.help | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Q) Parsing Command-Line Arguments Proud Japanese <hayato.fujimoto@yahoo.com> - 2011-08-09 05:28 -0700
  Re: Q) Parsing Command-Line Arguments markspace <-@.> - 2011-08-09 07:50 -0700
  Re: Q) Parsing Command-Line Arguments Roedy Green <see_website@mindprod.com.invalid> - 2011-08-09 09:52 -0700
  Re: Q) Parsing Command-Line Arguments Lew <lewbloch@gmail.com> - 2011-08-10 10:10 -0700
    Re: Q) Parsing Command-Line Arguments Lew <lewbloch@gmail.com> - 2011-08-10 16:34 -0700

csiph-web