Threads

  • June 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Threads as PDF for free.

More details

  • Words: 133
  • Pages: 1
1) In this exercise we will create a simple counting thread. It will count to 100, pausing one second between each number. Also, in keeping with the counting theme, it will output a string every ten numbers.

Hint ; Create a class and extend the Thread class. As an option, you can implement the Runnable interface. Override the run() method of Thread. This is where the code will go that will output the numbers. Create a for loop that will loop 100 times. Use the modulo operation to check whether there are any remainder numbers when divided by 10. Use the static method Thread.sleep() to pause. The long number represents milliseconds. 2) Writa program to display two String moving in opposite direction. 3)Write a program to display two String bouncing in opposite direction.

Related Documents

Threads
December 2019 37
Threads
May 2020 26
Threads
April 2020 15
Threads
June 2020 13
Threads
October 2019 28
Threads
July 2020 18