File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Someone can explain this? Why Output is so strange? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Someone can explain this? Why Output is so strange?" Watch "Someone can explain this? Why Output is so strange?" New topic
Author

Someone can explain this? Why Output is so strange?

Javan Li
Ranch Hand

Joined: Jul 24, 2002
Posts: 84
class test{
public static void main(String args[]){
for (int i = 0;i < args.length; i++) {
System.out.println("File " + i + ":" + args[i]);
}
if (args.length<=0) {
System.out.println("No files!");
}
}
}
Run with command:
java test *
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
What's strange about the output?


The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
Take a look at this past conversation.


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
Hiep Nguyen
Ranch Hand

Joined: Oct 26, 2001
Posts: 46
hi!
with your code, it will display all these file in the current dir, because the char '*' is special sign, it mean all the file
John Lee
Ranch Hand

Joined: Aug 05, 2001
Posts: 2545
Where is your optput?
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Someone can explain this? Why Output is so strange?