This is regarding the following question. I'm not sure why the link in the program goes to this post which seems to be about something else, but I'll post here anyway. Question:
com.enthuware.ets.scjp.v6.2.65
Consider the following two java files in /home/user directory:
//file A.java
package com.enthu;
class A
{
}
//file B.java
package com.foo;
class B
{
}
The files are compiled using the following command line:
javac -d /home *.java
Where will the class files go?
-------------------
The program says that "A.class in /home/com/enthu and B.class in /home/com/foo" is the correct answer. How can this be? The question says that the files are located in the /home/user directory, whereas the javac -d /home *.java command refers to the /home directory, thus the correct answer should be "No class file will be generated."
I understand the explanation of the -d command, but I've run a test and it does not recurse to subdirectories, at least on my Linux machine. Does it recurse elsewhere such as on Windows?
What is the correct answer?
Thanks for any tips.
About Question com.enthuware.ets.scjp.v6.2.65 :
Moderator: admin
-
- Site Admin
- Posts: 10385
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question com.enthuware.ets.scjp.v6.2.650 :
It seems the link is not matched correctly because the question ids are 650 and 65. This needs to be looked into.
-d option only directs the output location. You can run javac from any location. In this case, it can be safely assumed that it was run from /home/user. That is ok because the question says the classes were compiled. So there was no compilation issue.
HTH,
Paul.
-d option only directs the output location. You can run javac from any location. In this case, it can be safely assumed that it was run from /home/user. That is ok because the question says the classes were compiled. So there was no compilation issue.
HTH,
Paul.
Who is online
Users browsing this forum: witek_m and 18 guests