The first question in K&b book from chapter.6
And the command line:
java Regex2 "\d*" ab34ef
What is the result?
A. 234
B. 334
C. 2334
D. 0123456
E. 01234456
F. 12334567
G. Compilation fails.
Answer given in book is E. Conceptually the answer is correct. But, when
I execute this in my machine, I don't get anyof the above answers. I have
this file in my D:\ drive under the folder
:\work\java\scjp.
The first argument that is getting passed is not "\d*" in my case. But it
is "\downloads". downloads is one of my folder in D:\ drive. However
I'm in the d:\work\java\scjp directory. there is no folder by name "downloads" in this directory(d:\work\java\scjp).
The OS is windows XP. So, the above command line argument is "\d*" only
and not "\\d*"(i even tried the second parameter, which is interpreted by
java as "\\d*" and not "\d*", so no output in this case also).
My question is how to pass the parameter "\d*" in case of windows command
prompt. And the second question is why \d* expanded by the OS looks for
a directory under the root directory(D:\) and not the current directory(d:\work\java\scjp) from which the java was invoked.
Thanks,
Krishna.