Java多线程代码 [英] MultiThreaded Code For Java
问题描述
编写一个完整的覆盖线程程序,以满足以下要求
1.读取矩阵[A] M X N
2.创建M个线程
3.每个线程计算一行元素的总和,
打印结果.
主席先生,您好,我试图解决但实际上没有任何结果,我对线程对象的启动方式感到困惑,因为run方法不带参数.
因此,请给我一些相关程序,然后我会再试一次;如果您有时间,请给我以上程序解决方案.
关于Ravi Prajapati.
Write a complete mulch-threaded program to meet following requirements
1. Read Matrix [A] M X N
2. Create M Number of Threads
3. Each Thread Computes summation of elements of one row,
Print Result.
Hello Sir, I was try to solve but have not got any result actually i confused about how thread object start because run method take no argument.
so please give me some related program than i will try again and if you have time than please give above program solution.
Regards Ravi Prajapati.
推荐答案
您好,先生,我试图解决但实际上没有任何结果,我对线程对象的启动方式感到困惑,因为run方法不带参数.
Hello Sir, I was try to solve but have not got any result actually i confused about how thread object start because run method take no argument.
请参见
See "Pattern1" in "Constructing Threads and Runnables"[^]
您可以在Java ^ ],对于线程,请尝试此处 [^ ].您可能希望先尝试编写解决计算的方法,然后再尝试添加线程.
You can find lots of information on Java here[^], and for threads try here[^]. You may like to start by writing the method(s) that solves the calculation before trying to add threads.
这篇关于Java多线程代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!