Join David Gassner for an in-depth discussion in this video Implementing the Runnable interface, part of Java Advanced Training.
In a previous video I showed how to extend the Thread class to create a secondary thread…for your Java application.…There is another approach, creating a custom class that implements an interface called Runnable.…I'll demonstrate this using the project ImplementRunnable, which has a Main class and a custom class…that extends the Thread class.…So when you implement the runnable interface, it will have the same run method as when you…extend the Thread class as a super class.…
I'll go to my Package, right-click and create a new class, I'll call it MyRunnable,…and then instead of setting a super class I'll add an interface.…I'll click the Add button, type Runnable, and choose the Runnable interface from java.lang,…and then I'll click Finish.…Eclipse automatically adds the run method because it's a required method of the Runnable…interface, and so it must be implemented by the class.…
I'll go back to my custom class, and I'll copy the code from its run method.…Selecting everything inside the method signature, copying it to the clipboard, and then I'll…
- Installing Java on Windows and Mac OS X
- Installing Eclipse
- Using new features such as simplified generics
- Working with advanced class structures (member, local inner, etc.)
- Using the Reflection API
- Navigating inheritance trees
- Managing unordered and ordered sets
- Peeking and polling with queues
- Testing and error handling
- Managing files and directories
- Working with I/O streams
- Next steps with Java
Skill Level Advanced
1. Getting Started
2. Java 7 New Features
3. Using Advanced Class Structures
4. Using the Reflection API
5. More of the Collections Framework
6. Testing and Advanced Exception Handling
Using the finally keyword5m 40s
7. Managing Files and Directories in Java 7
8. Working with I/O Streams
9. Working with Multi-threading
- 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.