Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
2
20230403
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Patryk Czarnik
20230403
Commits
7e1cb20d
Commit
7e1cb20d
authored
Apr 03, 2023
by
Patryk Czarnik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Konto bez synchronizacji
parent
c624c4f5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
0 deletions
+44
-0
Przeploty.java
PC21-Watki/src/konto/Przeploty.java
+44
-0
No files found.
PC21-Watki/src/konto/Przeploty.java
0 → 100644
View file @
7e1cb20d
package
konto
;
public
class
Przeploty
{
public
static
void
main
(
String
[]
args
)
{
final
int
KWOTA
=
10
;
final
int
ILE_RAZY
=
100_000
;
Konto
konto
=
new
Konto
(
1
,
"Ala"
,
KWOTA
*
ILE_RAZY
);
System
.
out
.
println
(
"Stan początkowy: "
+
konto
.
getSaldo
());
Thread
wplacacz
=
new
Thread
(()
->
{
for
(
int
i
=
0
;
i
<
ILE_RAZY
;
i
++)
{
konto
.
wplata
(
KWOTA
);
}
});
Thread
wyplacacz
=
new
Thread
(()
->
{
try
{
for
(
int
i
=
0
;
i
<
ILE_RAZY
;
i
++)
{
konto
.
wyplata
(
KWOTA
);
}
}
catch
(
BrakSrodkow
e
)
{
e
.
printStackTrace
();
}
});
System
.
out
.
println
(
"Startujemy wątki..."
);
wplacacz
.
start
();
wyplacacz
.
start
();
System
.
out
.
println
(
"Czekam na zakończenie wątków..."
);
try
{
wplacacz
.
join
();
wyplacacz
.
join
();
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}
System
.
out
.
println
(
"...gotowe"
);
System
.
out
.
println
(
"Stan końcowy: "
+
konto
.
getSaldo
());
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment