Learn to construct objects with Java reflection.
- [Instructor] In the previous examples in this chapter,…we instantiated a student object…by calling its known noArugumentConstructor.…In this video, we will use reflection…to find a noArgumentConstructor for the student class…and then use its newInstance method…to instantiate a student object.…We will test this object in the same way…that we tested previous student objects.…Note, we're using java.lang.reflect.Parameter.…
In this course, I'm using Java 8.…This was not available before Java 1.6.…Let's begin by looking at our before method,…and recall that before is executed…before each individual test is executed.…Normally, we can't depend upon the execution among tests.…Here, we can depend upon the fact…that before will be executed.…As before, we get a class object.…
Now we use the class object to getDeclaredConstructors.…We're asserting that this is NotNull.…Here we're cheating a little bit…in a way we couldn't do during production,…and we're saying that we know in advance…that there's going to be two constructors.…
- The IMQAV model
- Downloading software
- Installing and setting up a Java coding environment
- Mock tests
- Code coverage
- Using windows, views, and modes in IntelliJ IDEA
- Creating classes and attributes
- Creating constructors
- Casting variables
- Matching literals with regular expressions
- Regular expressions
- Design patterns
Skill Level Intermediate
Java: Database Integration with JDBCwith David Gassner2h 51m Intermediate
NumPy Data Science Essential Trainingwith Charles Kelly3h 54m Intermediate
1. Getting Started with Java
2. Test-Driven Development
3. IntelliJ IDEA
4. Object-Oriented Java
6. Regular Expressions (Regex)
8. Design Patterns
9. Applying Data Science
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.