From the course: Java Threads
Unlock the full course today
Join today to access over 24,400 courses taught by industry experts.
Solution: Webinar polling system - Java Tutorial
From the course: Java Threads
Solution: Webinar polling system
(upbeat music) - [Instructor] Now I'll walk you through, step by step, how to solve the challenge. First, I've implemented the VotingRunnable class by the Runnable interface. By doing this, I'm making this class capable of implementing the running behavior that can be executed by a voting thread. To implement the running behavior, I've overridden the run method here. In the body of the run method, I've printed that voting is going on for the given design, d, by printing out its name. Also, I've added one vote to the list of votes for that design. Now let's go to the CountingRunnable class. Again, I've implemented the Runnable interface there as well. By doing that, I'm making this class capable of implementing the running behavior that can be executed by a counting thread. Like before, I've implemented the run method. We simply need a counting thread running this behavior to print out that the given Design has got…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
Thread class and Runnable interface2m 17s
-
(Locked)
Creating a thread: Extending the Thread class4m 4s
-
(Locked)
Creating a thread: Implementing the Runnable interface3m 31s
-
(Locked)
Starting a thread7m
-
(Locked)
Extend a thread or implement a Runnable?2m 27s
-
(Locked)
Challenge: Webinar polling system3m 25s
-
(Locked)
Solution: Webinar polling system3m 33s
-
-
-