String[] to String



/* I am writing this class to see the output of:

args.toString();

I want to see if the toString() method on the String[] will convert
the array contents into one string or it will write out it's type
name,
i.e. the <code>Class</code> class' name.


As observed, the output is

[java.lang.String@1693e2;

which looks like the array's underlying type's name and the starting
memory address.
*/
public class Ats /*implying Array To String */
{
public static void main(String[] args)
{
if ( args.length == 0 )
System.out.println("Usage: ats arg1 [arg2 [arg3...]]");
else
System.out.println(args.toString());
}
}

.



Relevant Pages

  • Re: findAverage ()
    ... writing a worker class which has other methodsaswell. ... getName,getAverage(both of which just return either a String name, or ... The average of the test mark scores is 1.8 ... >> in the array. ...
    (comp.lang.java.help)
  • Re: MD5 message digest conversion to 16 byte array
    ... If you actually implemented MD5, it's not likely that you want this. ... change the code that produces the string above to output a byte array instead. ... If, on the other hand, you're writing a function that has to take a string ...
    (comp.lang.c)
  • Re: Destructor: not gauranteed to be called?
    ... returns precisely this string and only this string every time: ... Then you believe that ToString applied to an Intshould return this string ... ToString from being applied to an array, ... I expected in the case of giving it a 'char'. ...
    (microsoft.public.dotnet.languages.vc)
  • Re: MD5 message digest conversion to 16 byte array
    ... If you actually implemented MD5, it's not likely that you want this. ... change the code that produces the string above to output a byte array instead. ... If, on the other hand, you're writing a function that has to take a string ...
    (comp.lang.c)
  • Re: toString equivalent for array
    ... >> concatenate the toString output of each element of the array? ... >> java root class). ... > public String toString(){ ...
    (comp.lang.java.programmer)