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 [Ljava.lang.String;@273dc3 does any one know what that output means? good luck, ak.
Thandapani Saravanan
Ranch Hand
Joined: Oct 17, 1999
Posts: 117
posted
0
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++)> System.out.println(args[i]);
Saravanan
Marilyn de Queiroz
Sheriff
Joined: Jul 22, 2000
Posts: 9033
10
posted
0
Ljava.lang.String;@273dc3
The @273dc3 is the address of the array args[]. Marilyn
JavaBeginnersFaq "Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Anonymous
Ranch Hand
Joined: Nov 22, 2008
Posts: 18944
posted
0
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 eg. if (args==true) print(args[0], args[1]); etc. else print(No args passed); something likethe pseudocode eg. shown above. ak.