FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
JavaCodes/Mythread7.java at main · raskarabhi45/JavaCodes · GitHub
raskarabhi45
/
JavaCodes
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
JavaCodes
/
Mythread7.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
92 lines (72 loc) · 1.68 KB
Breadcrumbs
JavaCodes
/
Mythread7.java
Copy path
File metadata and controls
92 lines (72 loc) · 1.68 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
//Used in company............
//same as 7X
import
java
.
lang
.*;
import
java
.
util
.*;
class
Marvellous
{
public
int
Arr
[];
public
Marvellous
(
int
size
)
{
Arr
=
new
int
[
size
];
}
public
void
Accept
()
{
Scanner
sobj
=
new
Scanner
(
System
.
in
);
System
.
out
.
println
(
"Enter numbers"
);
for
(
int
i
=
0
;
i
<
this
.
Arr
.
length
;
i
++)
{
this
.
Arr
[
i
]=
sobj
.
nextInt
();
}
}
public
void
Display
()
{
System
.
out
.
println
(
"Data from array is : "
);
for
(
int
i
=
0
;
i
<
this
.
Arr
.
length
;
i
++)
{
System
.
out
.
println
(
this
.
Arr
[
i
]);
}
}
public
void
DisplayEven
()
{
for
(
int
i
=
0
;
i
<
this
.
Arr
.
length
;
i
++)
{
if
(
this
.
Arr
[
i
]%
2
==
0
)
{
System
.
out
.
println
(
this
.
Arr
[
i
]);
}
}
}
}
class
Demo
extends
Thread
{
public
Marvellous
mref
;
public
Demo
(
Marvellous
obj
)
{
this
.
mref
=
obj
;
}
public
void
run
()
{
this
.
mref
.
DisplayEven
();
}
}
class
Mythread7
{
public
static
void
main
(
String
arg
[])
throws
Exception
{
Marvellous
mobj1
=
new
Marvellous
(
5
);
Marvellous
mobj2
=
new
Marvellous
(
8
);
mobj1
.
Accept
();
mobj1
.
Display
();
mobj2
.
Accept
();
mobj2
.
Display
();
Demo
dobj1
=
new
Demo
(
mobj1
);
Demo
dobj2
=
new
Demo
(
mobj2
);
Thread
t1
=
new
Thread
(
dobj1
);
Thread
t2
=
new
Thread
(
dobj2
);
t1
.
start
();
t2
.
start
();
t1
.
join
();
t2
.
join
();
System
.
out
.
println
(
"End of main Thread"
);
}
}
Back
|
FazBrowse Home
|
New Git URL