Win a copy of TensorFlow 2.0 in Action this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

Order for java files while compiling module

Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OCP Java SE 11 Programmer I Study Guide(Boyarsky and Selikoff ), Chapter 11 - Page 466 (Order Matters!)

as per the text in book, while compiling the module using javac command, order of the java files matters. can not be listed as first file if module is exporting some package and there is no class file exist for the package.

I ran the command with as the first file, without any exported package/class file already existed and not getting the error.

Also as the oracle java 13 documentation ( order does not matter. I couldn't find the documentation for java 11.

The order of source files specified on the command line or in an argument file is not important. javac will compile the files together, as a group, and will automatically resolve any dependencies between the declarations in the various source files.

Please check
author & internet detective
Posts: 40246
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I agree that order shouldn't matter. However, it did when I was testing the example. So I put a note in the book for anyone who ran into the same issue.
Beauty is in the eye of the tiny ad.
the value of filler advertising in 2020
    Bookmark Topic Watch Topic
  • New Topic