• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Doubt about \d*

 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't know what different about the args(something and "something") of String in main method.

and I make some codes.



the sorce code in G:\Java\chapter8\Testar.java
and when I type this java Testar \d*,the output is
Dos Here.reg and DS V are two files of eight in my G:\

Best Regards.
[ July 04, 2008: Message edited by: Jack Crifer ]
 
Sheriff
Posts: 11343
Mac Safari Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm not fluent in DOS, but it looks like d* is being interpreted by your command shell as all files in the current directory that begin with the letter 'd' (of which you have 2). Your system is taking the names of these files and concatenating them with the backslash before passing them as parameters to the main method of your Java program.

If you enclose \d* in quotes, then your system interprets the String as a literal instead of a command.
 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Nice question.

Look...
Whenever I say java fileName aaa bbb ccc,
The command line arguments are aaa, bbb, ccc.

Now, whenever I say java fileName \*, it means that I am passing all the names of all the directories and files in the root folder.
To be more precise, in Microsoft OS, when you have typed \* while working in any folder or subfolder in "E" drive, the names of all the files and folders in E: drive are supplied as CLA to java interpreted program.

Now, in your case you have typed java fileName \d*, which means all the files and folders starting with "d" in root directory.
Thats it!
[ July 05, 2008: Message edited by: Bhushan Chhajed ]
 
Jack Crifer
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you!

Best Regards.
reply
    Bookmark Topic Watch Topic
  • New Topic