Skip to content

Mismatched class names in code example and compiler output example #284

Open

Description

@authentictech

In Learn Java > Organizing your Application > Modules > Strong Encapsulation (of JDK Internals), Experiments with Strong Encapsulation section, there is a code example which includes the sun.util.BuddhistCalendar class which is different to the sun.util.PreHashedMap class given in the related compiler output, as below:

Code:

// add to `main` method
IO.println(sun.util.BuddhistCalendar.class.getSimpleName());

Compiler output:

Internal.java:8: error: package sun.util is not visible
                IO.println(sun.util.PreHashedMap.class.getSimpleName());
                                      ^
  (package sun.util is declared in module java.base, which does not export it)
1 error
error: compilation failed

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions