Java: Getting Started with Reflection
Java SE 15
| Intermediate
- 14 videos | 1h 55m 46s
- Includes Assessment
- Earns a Badge
Reflection is a popular programming technique that accesses and modifies class and object information at runtime. Reflection is available in many programming languages, but Java has an especially powerful set of reflection APIs that reflect - no pun intended - the emphasis that Java lays on type safety. Learn how to access a Java class object. Use reflection APIs to view class fields, constructors, and methods. Create objects for various built-in classes and use reflection to view the class of an object. Investigate the significance of the fully qualified name of a class and how you can use the .forName() method from the built-in class java.lang.Class. Use this method to obtain variables of primitive types and arrays of differing dimensionality. Then use reflection to access modifiers applied to member fields. Upon completion, you'll be able to use reflection in your Java operations with confidence.
WHAT YOU WILL LEARN
-
discover the key concepts covered in this coursecreate and set up a basic IntelliJ project to write java codedefine new classes and instantiate objects of these classesuse class handles accessed via reflection to explore properties of classesview fields, methods, and their modifiers using reflectionexamine how you can identify classes from their objectsuse reflection to identify a variety of classes from objects
-
get fully qualified names and simple names of classes using their handlesinvestigate how you can get a handle to class objects using just the class nameuse reflection to identify the modifiers of class membersidentify anonymous, local, member classes, and interfaces using reflectionidentify enums, arrays, and primitives using reflectionaccess package information, superclass, and declaring class informationsummarize the key concepts covered in this course
IN THIS COURSE
-
2m 19sIn this video, you’ll learn more about this course and your instructor. In this video, you’ll learn how to access a Java object that represents the class of a Java object. You’ll then move on to the use of Reflection APIs… FREE ACCESS
-
6m 51sHere, you’ll watch a demo. You’ll explore the use of reflection in Java. You’ll start at a terminal prompt on a Unix-based system. Then, you’ll switch over from a terminal prompt to IntelliJ. IntelliJ is an extremely… FREE ACCESS
-
7m 1sHere, you’ll watch a demo. You’ll begin by writing some code. You’ll see this is in the Employee.java class. Then, you’ll edit this class. You’ll start with an import statement. You’ll need to import java.util.Random.… FREE ACCESS
-
10m 35sHere, you’ll watch a demo. You’ll perform some simple operations using Reflection. You already have a class called Employee. You’ve instantiated that class and examined the two objects of the class you created. You’ll… FREE ACCESS
-
10m 53sHere, you’ll watch a demo. Here, you’ll move to reflection and make use of code to find the various methods, properties, and constructors that a particular object supports. You’ll clear most of the code you’ve already… FREE ACCESS
-
9m 43sHere, you’ll watch a demo. You’ll continue to explore the Reflection APIs in Java. The starting point for the use of Reflection is getting a handle on the class a particular object belongs to. That class is itself an… FREE ACCESS
-
11m 42sHere, you’ll watch a demo. As you’ve learned, every object knows its class. You had variables which were of type list and list is an interface in Java. You’ll explore how different types of objects in Java know their… FREE ACCESS
-
8m 37sHere, you’ll watch a demo. You’ll continue with the theme of accessing the class of an object. You’ll turn your focus to user-defined classes. First, you’ll clear the contents of your current main class and open up… FREE ACCESS
-
9m 11sHere, you’ll watch a demo. You’ll see how to get a handle on a class from the name of the class in the form of a string. This is an important bit of functionality. You’ll use it to make runtime decisions about which… FREE ACCESS
-
8m 8sHere, you’ll watch a demo. You’ll pick up from where you left off in the last demo. You’ll continue with reflection operations. You’ll see how to query all of the properties of a class object. For instance, its modifiers,… FREE ACCESS
-
11m 40sHere, you’ll watch a demo. You’ll learn about other kinds of metadata that you might want to query. For instance, you’ll learn about type parameters, whether a class is an anonymous or an inner class, and so on. First,… FREE ACCESS
-
4m 34sHere, you’ll watch a demo. In this demo, you’ll continue exploring metadata. You’ll start with enumerated types also known as enums. First, you’ll clear the contents of your Main method and then introduce our enum… FREE ACCESS
-
11m 57sHere, you’ll watch a demo. You’ll turn your attention to type parameters and package information. You’ll clear the code. Then, you’ll reintroduce your private static final class HR. This extends Department. Department is… FREE ACCESS
-
2m 35sIn this video, you’ll summarize what you’ve learned in this course. You’ve learned how to access a Java object that represents the class of that Java object using the .getClass method. You explored the use of various… FREE ACCESS
EARN A DIGITAL BADGE WHEN YOU COMPLETE THIS COURSE
Skillsoft is providing you the opportunity to earn a digital badge upon successful completion on some of our courses, which can be shared on any social network or business platform.
Digital badges are yours to keep, forever.