Java多线程代码 [英] MultiThreaded Code For Java

查看:83
本文介绍了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.

请参见"Pattern1" .com/tutorials/threads/thread_runnable_construction.shtml>构造线程和可运行对象" [

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆