Learn about Java implementation of singleton patterns.
- [Instructor] A class that is based upon…a Singleton pattern restricts object creation…to a single instance of that class.…The print queue accessor class in your solutions model…simulates providing access to a print queue.…We'll assume that there is a requirement that…only one object has access to this queue.…After we create the class, we create a private static field…based on the queue interface.…We'll parametrize this to a string…and we'll call it hidden print queue.…In production, if we were developing a print queue,…we wouldn't parametrize it with string,…we'd have something like, a print job, or something…an object along those lines.…
But since we're really interested in learning about the…Singleton pattern, a string is sufficient…for teaching purposes.…Next, and this is the key, to a Singleton pattern,…we create a constructor and we label it, private.…Here in the comments we can see,…this restricts public access.…If we were to have additional constructors,…and there wouldn't be a reason to,…we would mark each of those private, also.…
- 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?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
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.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.