GithubHelp home page GithubHelp logo

random_numbers's Introduction

Random_Numbers

Small thread exercise in Java

The random numbers were supposed to be printed on the console, but I decided to use 2 JTextFields to show the numbers

Exercise: "Write an application that has a window with a JButton ("Stop"). When the application starts, it should create and start two different threads: Thread A should generate random numbers between 1000 and 9999 in a loop until it is interrupted. Each time a new random number has been generated, it should be output to the console. The loop should contain no sleeps! Thread B should generate random numbers between 1 and 9 in a loop until it is interrupted. Each time a new random number has been generated, the number should be output to the console. Between each new number generated, Thread B should sleep for 0.5 seconds.

Both Thread A and Thread B should keep track of how many numbers they have generated. When the "Stop" button is pressed, both threads should end. When they have ended, your application should print the number of random numbers generated by Thread A and Thread B, respectively (you can use a System.out.println("")). Notice that it is IMPORTANT to ensure that both Thread A and Thread B have really ended before printing out the number of random numbers generated by each of them."

random_numbers's People

Contributors

rubenmfonte avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.