File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Output of 'args' gives some wierd info...? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Output of Watch "Output of New topic

Output of 'args' gives some wierd info...?

Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
when i give
System.out.println(args);//ToArgs is the name of the prog.
in my code i get some wierd results during my interpretation.....
ie. the compile works fine....the interpretation gives me....
d:\>java ToArgs
does any one know what that output means?
good luck,
Thandapani Saravanan
Ranch Hand

Joined: Oct 17, 1999
Posts: 117
Remember the argument to main method is an array of Strings. When you try print an array as such, that is output you get. (it calls Object's toString())
If you want to print all entries try printing them one by one:
for(int i=0;i<args.length;i++)>

Marilyn de Queiroz

Joined: Jul 22, 2000
Posts: 9059

The @273dc3 is the address of the array args[].

"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
What if i want to put a condition check on the args. passed.
ie. Say if a persson passes arguments then print them else say no args. passed
if (args==true)
print(args[0], args[1]); etc.
else print(No args passed);
something likethe pseudocode eg. shown above.
Steve Fahlbusch

Joined: Sep 18, 2000
Posts: 602

you could try something like:
<pre>class TestArgs {
public static void main ( String[] args ) {

if ( args.length > 0 ) {
for ( int i = 0; i < args.length; i++ ) {
System.out.println( args[i] );
} else {
System.out.println("No arguments");
I agree. Here's the link:
subject: Output of 'args' gives some wierd info...?
It's not a secret anymore!