PLEASE SUBSCRIBE!!!
In the previous lesson ( • Java Programming: Lesson 47 - File I/O ), we looked at file I/O, which is the process of creating, writing to, and reading from text files. We review the theory here, and then we press on to talk about threading in Java.
Option 1 for threading:
1. Create a class that extends Thread, call it Apple
2. in Apple, define a void instance method called run( ) and give it instructions
3. Create a class that tests the class created in step 1, called AppleTester
4. Create a static main method in AppleTester
5. In the main method, create an instance of Apple with a default constructor (no parameters), call it P
6. In the main method, call P.start( )
Option 2 for threading:
1. Create a class that implements Runnable, call it Banana
2. in Banana, define a void instance method called run( ) and give it instructions
3. Create a class that tests the class created in step 1, called BananaTester
4. Create a static main method in BananaTester
5. In the static method, create an instance of Banana with a default constructor (no parameters), call it Q
6. In the main method, create an instance of Thread and pass in Q created in step 5, call it R
7. In the main method, call R.start( )
0:13 Review of File I/O
7:53 NEW: Intro to Threading
9:41 NEW: Threading by extending Thread
15:52 NEW: Threading by implementing Runnable
Ok, ready for LinkedLists? Check it out here: • Java Programming: Lesson 49 - Intro to Lin... (they're better than ArrayLists in a way...)
Thanks for watching, and PLEASE SUBSCRIBE!!!
On this page of the site you can watch the video online Java Programming: Lesson 48 - Threading with a duration of hours minute second in good quality, which was uploaded by the user youmils03 27 September 2021, share the link with friends and acquaintances, this video has already been watched 49 times on youtube and it was liked by 0 viewers. Enjoy your viewing!