Campbell Ritchie wrote:Please don't quote the whole of the preceding post. Please tell us what the solution was.
Paul Clapham wrote:Are you simply asserting that an exception will be thrown, or do you have some evidence for that statement?
(By the way: when you make a post, isn't there an "Attachments" tab at the bottom of the box where you type your post? Using that would be much preferred compared to making readers go to some other site.)
Early Charlemagne wrote:Hi,
I have a query about Automatic modules.
On Chapter 6 in the Java OCP 11 Programmer II Study Guide by Scott Selikoff and Jeanne Boyarsky it's written "A key point to remember is that code on the classpath can access the module path. By contrast, code on the module path is unable to read from the classpath."
Also, looking at Table 6.3 (see attachment) I understand that Automatic modules cannot access unnamed modules on the classpath.
However, I read elsewhere the following:
Remember that modular code cannot access code present on the -classpath but "automatic modules" are an exception to this rule. When a non-modular jar is put on --module-path, it becomes an "automatic module" but it can still access all the modular as well as non-modular code. In other words, a class from an automatic module can access classes present on --module-path as well as on -classpath without having any "requires" clause
Did I misunderstand the information in Java OCP 11 Programmer II Study Guide?
Paul Clapham wrote:I'm sorry, I still don't understand what it means to "retake looping".
Instead let me try again with an explanation of what happens. The ExecutorService is given 10 Runnable objects to execute. This happens almost immediately as there's a loop which gives the objects to the ExecutorService. In case it isn't clear, the loop doesn't execute the Runnable objects in any way.
When the ExecutorService executes one of those objects, the object sleeps for a while and then increments/prints the value of the AtomicInteger.