Hi everyone,
I have a question about threads. Consider the below program
As you can see above i have three methods in the above class. My question is how do i call each of these methods in a separate thread either in the class main or in the class itselfCode:public class test { public void test1() { System.out.println("Test 1"); } public void test2() { System.out.println("Test 2"); } public void test3() { System.out.println("Test 3"); } public static void main(String args[]) { test a = new Jtest(); a.test1(); a.test2(); a.test2(); } }
Consider the below method
As you can see from the above method i have two command lines in the above method. My question is how do i call each command line in a separate thread.Code:public void test() { System.out.println("Test 1"); //command line 1 System.out.println("Test 2"); //command line 2 }
Basically i need to know how to call a specific method or a specific command line in a separate thread excluding the main thread
I hope someone can help me with both these questions
Any help is greatly appreciated
Thank You
Yours Sincerely
Richard West


Reply With Quote


Bookmarks