FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
java-programs/Thread/threads.java at main · IntScription/java-programs · GitHub
IntScription
/
java-programs
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
1
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
java-programs
/
Thread
/
threads.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
32 lines (30 loc) · 957 Bytes
Breadcrumbs
java-programs
/
Thread
/
threads.java
Copy path
File metadata and controls
32 lines (30 loc) · 957 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/* Write a java program that implements Thread class methods */
package
Thread
;
class
threads
extends
Thread
{
public
void
run
(){
for
(
int
i
=
1
;
i
<=
5
;
i
++){
try
{
System
.
out
.
println
(
"running thread name is: "
+
Thread
.
currentThread
().
getName
());
System
.
out
.
println
(
"running thread priority is:"
+
Thread
.
currentThread
().
getPriority
());
}
catch
(
Exception
e
){
System
.
out
.
println
(
e
);
}
System
.
out
.
println
(
i
);
}
}
public
static
void
main
(
String
args
[]) {
threads
t0
=
new
threads
();
threads
t1
=
new
threads
();
threads
t2
=
new
threads
();
t1
.
setPriority
(
Thread
.
MAX_PRIORITY
);
t2
.
setPriority
(
Thread
.
MIN_PRIORITY
);
t0
.
start
();
try
{
t0
.
join
();
}
catch
(
Exception
e
) {
System
.
out
.
println
(
e
);
}
t1
.
start
();
t2
.
start
();
}
}
Back
|
FazBrowse Home
|
New Git URL