Oracle
Oracle
Email Icon   Forward to a friend
Oracle Logo
Java Magazine banner Image
Java Magazine banner Image
Let’s reflect on Java reflection

Plus: Java 20 is here, and so are random numbers
March 2023
Visit Java Magazine
Within the JVM, you’ll find rich runtime type information about every executing Java program, such as about its class hierarchy. As Ben Evans explains, the details of the hierarchy are contained in the class files, because each individual class refers to the types it depends upon.

The JVM, during the class loading process, assembles this data into a representation of a graph that describes the class inheritance and interface implementation of every type in the system. This includes JDK types, third-party libraries, and custom, user-defined classes of the application.

This inheritance metadata is always present for every type. And guess what? The good news is that your program can access and leverage that runtime metadata, leading to reflective programming that lets you solve interesting problems in an interesting way.

Effectively, with reflection, you write Java source code that composes and prepares code written for the JVM’s low-level, dynamically typed environment.

Read Ben’s article to see how reflection works and try it out.

Take care,
Alan Zeichick
Editor in Chief, Java Magazine
@zeichick

P.S. Java 20 is officially here! Links to key resources are included below.
The newest Java Magazine articles
Reflection for the modern Java programmer
Reflection can be complicated, but as Ben Evans explains, one way of thinking about reflection is that it’s posing the following question: “What if the JVM exposed the Java application’s runtime metadata (which is guaranteed to exist) and allowed programmers to access and use it during the execution of their programs?”

Java 20 is here: Strengthening Java’s foundation for the future
The innovative new enhancements in Java 20 reflect the vision and invaluable efforts the global community has contributed throughout the platform’s existence. Java has never been more relevant as a contemporary language and platform that helps developers improve productivity.

Pseudorandom numbers in Java, Part 1: The Background
What is randomness? And how does it relate to Java’s random number generators? Ian Darwin unpacks this subject for software developers who may or may not be mathematics whizzes. He even talks about lava lamps.

Pseudorandom numbers in Java, Part 2: Randomness with Java 17
Java 17 introduced a new interface, java.util.random.RandomGenerator, to consolidate the implementations of existing and new random number generators. Building off the previous article, Ian Darwin explores the latest interface and shows how it works.

Java! Read all about it in these new developer books.
Ready to gain more knowledge about Java? Do you want to share the gift of Java knowledge with your colleagues or with aspiring developers? Check out a bunch of recently published or forthcoming titles on a variety of Java-related topics.
Resources from the Java 20 launch
Java 20 was released on March 21. Here are several key resources.

  • Oracle Releases Java 20 (press release)
  • The Arrival of Java 20 (technical blog)
  • JDK 20 Release Notes
  • JDK Security Enhancements
  • Java 20 Sneak Peek
  • Download Java 20
Other recent Java Magazine articles
Curly Braces #9: Was Fred Brooks wrong about late software projects?

Embedded Java: Then and now

Reduce technical debt by valuing comments as much as code

Introducing the Visual Recognition spec for Java machine learning

Daisuke Araki—The millionth Oracle Certified Java Developer

Efficient JSON serialization with Jackson and Java

Nothing is better than the Optional type. Really. Nothing is better.

Bruno Souza, the Brazilian Java Man, accepts lifetime achievement award
Visit Java Magazine
Complimentary subscription to Java Magazine
Java Magazine is a deep dive into Java and the JVM. Find detailed explanations about the language and the platform written by experts and members of the Java development team.

Join a quarter of a million subscribers in getting useful, authoritative programming information delivered directly to your inbox.
Subscribe
Stay connected
#oraclejavamag | dev.java
Facebook Twitter RSSfeed
Terms of Use and Privacy | Unsubscribe | Contact Us | 
This email was sent to you because you subscribed to this newsletter.

Copyright © 2023, Oracle and/or its affiliates. All rights reserved. Oracle Corporation - Worldwide Headquarters, 2300 Oracle Way, Austin, TX 78741, United States
Oracle