Questions tagged [java-16]

Use this tag for questions specific to Java 16, which is version 16 of the Java platform, released on March 16, 2021. In most cases you should also specify the java tag.

This release is the Reference Implementation of version 16 of the Java SE Platform, as specified by JSR 391 in the Java Community Process.

124 questions
-3
votes
2 answers

How can I make reflection work on JDK 16 and later?

I have the following legacy code that I migrated to Java 16 but, due to the strong encapsulation introduced by this new version, it doesn't work: try { Method method = URLClassLoader.class.getDeclaredMethod("addURL", URL.class); …
JJB
  • 202
  • 4
  • 11
-4
votes
1 answer

How do I create a jar file via the command line?

Lets say I have these .java files: MainClass.java 2ndClass.java BarClass.java FooClass.java Then I turn them into .class files: MainClass.class 2ndClass.class BarClass.class FooClass.class How would I make it a jar file, and have MainClass.class…
TheTank20
  • 89
  • 1
  • 6
-4
votes
1 answer

How does Java's record class implement synchronization?

Since Record class instance does not have the obj header which common Object instance has. But we can still use synchronization features like: public record User(long id, String name, int age) {} User user = new User(1, "name", 18); synchronized…
Hash Jang
  • 599
  • 3
  • 11
-5
votes
1 answer

How to convert a given string to an immutable list of characters in java? [Updated]

I am looking for a solution to convert a given string for example: “helloworld” to a list of characters which should be immutable in nature. What I already tried is using StreamApi 'Stream.collect(Collectors.toList())' however this results in a…
GD07
  • 1,117
  • 1
  • 7
  • 9
1 2 3
8
9