Ask a Question
Ask Question Login
Corporate Training
  1. Community
  2. Java
  3. Question
Java

Are Java modules and packages different?

Asked by Prashant Oct 13, 2022 200 views 1 answer
Share

About this question

Java 9 will have modules in addition to packages. Usually languages have one or the other. And most programmers perceive two terms as synonyms.

Modules are built on top of packages, treating them as primitives.

Composite pattern suggests to treat primitives and composites uniformly. Otherwise bad things will happen. For example, look at project Valhalla, where they try to retrofit common supertype for primitive (value) and reference types.

Do modules and packages represent semantically separate notions?

Meaning it is sensible to have both for any language (separation of concerns). Or Java has to have both as a tribute to backward compatibility?

Why introduce a new concept instead of augmenting the existing one?

Your answer

1 Answer

More Java discussions

Learn & Explore

Free tutorials and interview questions from industry experts — learn the skill, then get ready to prove it.

Latest Java Blogs

Guides, tips and career advice on Java from JanBask experts.