Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

A. Suppose you have a single directory on your CLASSPATH, /Users/student/src/. T

ID: 3888112 • Letter: A

Question

A. Suppose you have a single directory on your CLASSPATH, /Users/student/src/. That is, the src directory (located inside student, located inside Users) is on your classpath.

Suppose the first line of a Java source file named “Banana.java” is:

Where exactly should this file be located? Specify the full path to the file. For example, a wrong answer is “in /Users/Banana.java”. Another wrong answer is /produce/fruits/Banana.java.

B. Suppose we add a file named “Broccoli.java” to the project above, and we want the Broccoli class to reside in the produce.vegetables package. What should the first line (the packagedeclaration) of the Broccoli.java file be? And, what should the full path to the file be?

C. Finally, suppose we want to reference the Broccoli class from within the “Banana.java” source. What import statement, if any, do we need to add to the Banana.java file?

Explanation / Answer

Answers:

A) "Banana.java" file will be located at:

Usersstudentsrcproduce ruitsBanana.java

B) First line of the Broccoli.java will be:

package produce.vegetables;

"Broccoli.java" file will be located at:

Usersstudentsrcproduce egetablesBroccoli.java

C) To use Broccoli class reference within the "Banana.java" class, we need to import below statement.

import produce.vegetables.Broccoli;

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote