educative.io

What does a particular classpath mean

In the lecture I saw three kinds of classpaths, test, compile and runtime.
I cannot understand what a particular classpath indicates.

E.g.
Suppose I have a dependency on junit, and I have written code associated with this, using annotations like @Test etc.
Scope of test means it is only present on test classpath
Now how can my java code be “compiled” if my code contains annotations like @Test, and junit isn’t included during compilation?


Type your question above this line.

Course: https://www.educative.io/collection/5352985413550080/5706364891430912
Lesson: https://www.educative.io/collection/page/5352985413550080/5706364891430912/5876316931883008

The assertions are not checked when the program is run in the normal way. If you are correct in your belief that the method is never called with illegal arguments, then checking the conditions in the assertions would be unnecessary. If your belief is not correct, the problem should turn up during testing or debugging, when the program is run with the assertions enabled.

java -enableassertions RootFinder

will run the program with assertions enabled. The -enableassertions option can be abbreviated to -ea, so the command can alternatively be written as

java -ea RootFinder

1 Like